N,K = map(int,input().split()) import sys S = N * (N + 1) // 2 L = S - K s = set() now = 0 s.add(now) for i in range(1,N + 1): now += i if now - L in s: print(1) exit() s.add(now) print(2)