n, k = map(int, input().split()) for i in range(1, n): kk = (n * (n + 1) - i * (i + 1)) // 2 - k if kk < 0: break if kk > i * (n - i): continue if kk % i == 0: print(1) exit() print(2)