n,k=map(int,input().split()) se=set([0]) kk=(n+1)*n//2-k x=0 for i in range(1,n+1): x+=i se.add(x) if kk+x in se: print(1) exit() print(2)