#include using namespace std; using Int = long long; #define MOD 1000000007 #define MAX_P 200005 Int fact[MAX_P],inv[MAX_P],finv[MAX_P];; Int extgcd(Int a,Int b,Int& x,Int& y){ Int d=a; if(b!=0){ d=extgcd(b,a%b,y,x); y-=(a/b)*x; }else{ x=1;y=0; } return d; } Int mod_inverse(Int a,Int mod){ Int x,y; extgcd(a,mod,x,y); return (mod+x%mod)%mod; } Int mod_pow(Int x,Int n,Int mod){ Int res=1; while(n){ if(n&1) (res*=x)%=mod; (x*=x)%=mod; n>>=1; } return res; } Int mod_inverse2(Int a,Int mod){ return mod_pow(a,mod-2,mod); } void init(Int mod){ fact[0]=1; for(Int i=1;ie2+e3) return 0; return a1*mod_inverse(a2*a3%mod,mod)%mod; } Int mod_comb2(Int n,Int k,Int mod){ Int res=1; for(Int i=0;in) return 0; return fact[n]*finv[k]%mod*finv[n-k]%mod; } Int montmort(Int n,Int mod){ Int res=0,inv=1; for(Int k=2;k<=n;k++){ (inv*=mod_inverse(k,mod))%=mod; if(k%2) (res+=mod-inv)%=mod; else (res+=inv)%=mod; } for(Int i=1;i<=n;i++) (res*=i)%=mod; return res; } //INSERT ABOVE HERE Int LagrangePolynomial(vector &y,Int t,const Int mod){ init(mod); Int n=y.size()-1; Int num=1; for(Int i=0;i<=n;i++) num=num*((t-i)%mod)%mod; Int res=0; for(Int i=0;i<=n;i++){ Int tmp=(y[i]*num%mod)*mod_inverse((t-i)%mod,mod)%mod; tmp=tmp*finv[i]%mod; tmp=tmp*finv[n-i]%mod; if((n-i)&1) tmp=mod-tmp; res=(res+tmp)%mod; } return res; } signed main(){ Int n,k; cin>>n>>k; vector y(k+101,0); for(Int i=1;i<=k+100;i++) y[i]=(y[i-1]+mod_pow(i,k,MOD))%MOD; if(n<=k+100) cout<