from math import sqrt N,K=map(int,input().split()) SUM=0 ANS=2 for i in range(N,-1,-1): rest=K-SUM if rest<0: continue x=round((-1+sqrt(1+9*rest))/2) if x*(x+1)==rest*2: ANS=1 SUM+=i print(ANS)