There are *n* walruses sitting in a circle. All of them are numbered in the clockwise order: the walrus number 2 sits to the left of the walrus number 1, the walrus number 3 sits to the left of the walrus number 2, ..., the walrus number 1 sits to the left of the walrus number *n*.

The presenter has *m* chips. The presenter stands in the middle of the circle and starts giving the chips to the walruses starting from walrus number 1 and moving clockwise. The walrus number *i* gets *i* chips. If the presenter can't give the current walrus the required number of chips, then the presenter takes the remaining chips and the process ends. Determine by the given *n* and *m* how many chips the presenter will get in the end.
The first line contains two integers *n* and *m* (1 ≤ *n* ≤ 50, 1 ≤ *m* ≤ 10<sup class="upper-index">4</sup>) — the number of walruses and the number of chips correspondingly.
In the first sample the presenter gives one chip to the walrus number 1, two chips to the walrus number 2, three chips to the walrus number 3, four chips to the walrus number 4, then again one chip to the walrus number 1. After that the presenter runs out of chips. He can't give anything to the walrus number 2 and the process finishes.

In the third sample the presenter gives one chip to the walrus number 1, two chips to the walrus number 2, three chips to the walrus number 3, then again one chip to the walrus number 1. The presenter has one chip left and he can't give two chips to the walrus number 2, that's why the presenter takes the last chip.
4 11
0
17 107
2
3 8
1
46 7262
35
32 6864
0
36 6218
14
25 9712
11
9 7601
5
1 9058
0
29 7772
26
45 9465
14
46 866
5
29 1241
20
17 4248
12
20 8082
11
50 9555
0
4 7455
2
36 880
4
24 7440
9
44 7888
12
1 1
0
50 10000
40
1 10000
0
50 1
0
50 50
5
n, m = [int(x) for x in input().split()]
arr = [i+1 for i in range(n)]

total = n*n+1 // 2
m = m  % total
i = 0
while True:
    # print("val", arr[i])
    if arr[i] <= m:
        m -= arr[i]
    else:   
        break
    i += 1
    i %= n

print(m)