N,K=map(int,input().split()) num=N while(True): if num<=K: K-=num num-=1 if K<=1 or K==num: print(1) exit() elif 1