def BI(n,r): res=1 for i in range(r): res*=n-i res=res//i+1 return res N=int(input()) M=int(input()) if M>N : print("0\n") elif N==0 : print("1\n") else : T=[0]*(M+1) for i in range(1,M+1): T[i]=1 for j in range(N): T[i]*=j+1 for j in range(i): T[i]-=T[j]*BI(i,j) print(T[M])