mod = 998244353 def main(): import sys input = sys.stdin.readline N, K = map(int, input().split()) ans = 2 R = {0} r = 0 for i in range(N, 0, -1): r += i R.add(r) l = 0 if K in R: ans = 1 for i in range(1, N+1): l += i if K - l in R: ans = 1 print(ans) if __name__ == '__main__': main()