一句话: 求 (sum^{n}_{i=1}{C(n,i)*i^k})
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
#define ll long long
const int mod=1e9+7,_=5e3+10;
inline int read(){
int x=0,f=1;
char c=getchar();
while(c<'0'||c>'9') f=(c=='-')?-1:1,c=getchar();
while(c>='0'&&c<='9') x=x*10+c-48,c=getchar();
return f*x;
}
ll s[_][_];
int n,k;
inline void init(){
n=read(),k=read();
s[0][0]=1;
for(int i=1;i<=k;i++)
for(int j=1;j<=i;j++)
s[i][j]=(s[i-1][j-1]+j*s[i-1][j])%mod;
}
inline ll ksm(int b){
ll ans=1,a=2;
while(b){if(b&1)ans=ans*a%mod;a=a*a%mod; b>>=1;}
return ans;
}
signed main(){
init();
ll p=ksm(n),ans=0,js=1,inv=500000004;
for(int i=0;i<=k;i++){
ans=(s[k][i]*p%mod*js+ans)%mod;
p=(p*inv)%mod;
js=js*(n-i)%mod;
}
printf("%lld
",ans);
}