main=do
 [k,s]<-map read.words<$>getLine
 print(f s k (k*k+2*k+1) [[x,y]|x<-[0..k],y<-[0..k]] 0)
  where f _ _ 0 _ a = a
        f s k n z a = f s k (n-1) (tail z) (if k>=(s-(sum(z!!0)))&&(s-(sum(z!!0)))>=0 then (a+1) else a)