import sys input = lambda :sys.stdin.readline()[:-1] ni = lambda :int(input()) na = lambda :list(map(int,input().split())) yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES") no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO") ####################################################################### n, k = na() k = n * (n+1)//2-k f = [i*(i+1)//2 for i in range(n+1)] from bisect import bisect_left as bl for i in range(n+1): j = bl(f, f[i] - k) if f[i] - k == f[j]: print(1) exit() print(2)