M=10**9+7;F=[1];Q=[r=0];P=->a,n=M-2{a.pow(n,M)};N,K=gets.split.map &:to_i;a=N 1.upto(K+1){|i|a=a*(N-i)%M;Q<<(P[i,K]+Q[-1])%M;F<