N, K = gets.split.map(&:to_i) S = N * (1 + N) / 2 if S == K puts 0 exit end sum = N * (1 + N) / 2 - 1 l = 1 r = 1 while l <= r if sum == K puts 1 exit end if r == N sum += l l += 1 elsif sum < K sum += l l += 1 else r += 1 sum -= r end end puts 2