#include #define REP(i,n) for(int i=0;i<(n);i++) #define ALL(v) (v).begin(),(v).end() #define int long long using namespace std; //----------------------------------------------------------------------- const int mod=1e9+7; int mod_pow(int x,int n) { int res=1; while(n){ if(n&1) res=(res*x)%mod; x=x*x%mod; n>>=1; } return res; } signed main() { int N,K; cin>>N>>K; int ans=0; for(int i=1;i<=N;i++){ ans+=mod_pow(i,K); ans%=mod; } cout<