题目描述
Problem Description
Tenshi is very fortunate to be chosen as the angel in charge of the key to wisdom. Before officially taking office, she, like other newly elected angels, must take an oath.
The oath ceremony involves each angel expressing their mission. Their speeches are placed in $n$ treasure boxes arranged in a circular pattern. These boxes are numbered clockwise from $1$ to $n$.
Initially, the angels stand beside the box numbered $n$. Each of them holds a number representing the box where their speech is located, counted clockwise starting from box $1$. For example, with $7$ boxes, if Tenshi's number is $9$, then her speech is in box $2$. The angels start looking for their speeches based on the numbers they hold, and the one who finds it first gets to speak first.
Tenshi quickly finds her box and is the first to take the stage to swear: "I will lead everyone to open the door to NOI..." After Tenshi's oath, other angels gradually take the stage to swear. However, one angel has been looking for a long time without finding her speech. It turns out that the number $m$ she holds is very large, and she has been rotating for a long time without finding the box she wants.
Please help this angel find the box number she is looking for.
Input Format
The first line is a positive integer $n$.
The second line is a positive integer $m$.
Output Format
Only one line (including the newline character), which is the box number the angel is looking for.
Sample Input and Output
Sample Input #1
7
9
Sample Output #1
2
Sample Input #2
11
108
Sample Output #2
9
Notes/Hints
For $100\%$ of the data, $2 \le n \le 10^8$, $2 \le m \le 10^{1000}$.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分