n,k=map(int,input().split()) k=n*(n+1)//2-k if bin(k).count('1')==1 and k>n: print(2) else: print(1)