from collections import defaultdict n,k = map(int,input().split()) k = n*(n+1)//2 - k d = defaultdict(int) for i in range(1, n+1): d[i*i - i] = i # r(r+1) - l(l-1) = 2k # (r^2+r) - (l^2-l) = 2k # r^2+r = 2k + (l^2-l) ans = 2 for i in range(1, n+1): t = i*i + i - 2*k if 0 < d[t] <= i: ans = 1 print(ans)