N,K = map(int,input().split()) def comb(n,k): if k<0 or k>n:return 0 if k==0 or k==n:return 1 return comb(n-1,k-1)+comb(n-1,k) ans = 0 for i in range(N-K+1): ans += comb(N-K,i) if K==1: print(ans-(N-K+1)) else: print(ans)