stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

#include<vector>

#define int long long int

#define mod 1000000007

vector<int> vec;

bool prime[100001]={false};

void function()

{

	int j;

	for(j=2;j<=100000;j++)

	{

		prime[j]=true;

	}

	for(j=2;j<=1000;j++)

	{

		if(prime[j])

		{

			for(int k=2;j*k<=100000;k++)

			{

				prime[j*k]=false;

			}

		}

	}

	for(j=1;j<=100000;j++)

	{

		if(prime[j])

		{

			vec.push_back(j);

		}

	}

}

int power(int a,int b)

{

	if(b==0)

	  return 1;

	if(b==1)

	  return a%mod;

	else

	{

		int r=power(a,b/2);

		if(b%2==0)

		{

			return (r*r)%mod;

		}

		else

		{

			int x=(r*r)%mod;

			return (a*x)%mod;

		}

	}

}

int32_t main()

{

	function();

    int n,k;

    cin>>n>>k;

    int arr[k+2]={0};

    int j;

    for(j=k;j>=1;j--)

    {

		int div=k/j;

		int val=power(div,n);

		int i;

		for(i=2;i<=k;i++)

		{

			int p=j*i;

			if(p<=k)

			{

                val-=arr[p];

                val=val%mod;

			}

			else

			{

				break;

			}

		}

		arr[j]=val%mod;

	}

    int answer=0;

    for(j=1;j<=k;j++)

    {

		int val=(j*(arr[j]%mod))%mod;

		answer+=val;

		answer=answer%mod;

	}

	cout<<answer<<endl;

}


// Optimized solution to the same problem (faster):
#include<iostream>

#include<cmath>

#include<map>

#include<set>

#include<vector>

#include<algorithm>

#include<iomanip>

using namespace std;

#define mod 1000000007

#define int long long int

int power(int a,int b)

{

	if(b==0)

	  return 1;

	int r=power(a,b/2);

	if(b%2==0)

	{

		return (r*r)%mod;

	}

	else

	{

		int x=(r*r)%mod;

		return (a*x)%mod;

	}

}

int32_t main()

{

	int n,k;

	cin>>n>>k;

	int arr[k+1];

	int j;

	for(j=k;j>=1;j--)

	{

		int total=k/j;

		int sub=power(total,n);

		int i;

		for(i=2;i*j<=k;i++)

		{

			sub-=arr[i*j];

			sub=sub%mod;

		}

		arr[j]=sub;

	}

	int answer=0;

	for(j=1;j<=k;j++)

	{

		answer=answer+j*arr[j];

		answer=answer%mod;

	}

	if(answer<=0)

	  answer+=mod;

	cout<<answer<<endl;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef vector<ll> vec;

typedef vector<vec> mat;

typedef pair<ll,ll> pll;

const ll mod=1e9+7;

//const ll mod=998244353;

const ll inf=5e18;



ll n,k;

vec cnt(1e5+10,-1);

vec ans(1e5+10,-1);



ll mpow(ll x, ll n) {

  ll ans=1;

  while(n>0) {

    if(n&1) {

      ans=ans*x%mod;

    }

    x=x*x%mod;

    n>>=1;

  }

  return ans;

}



ll dfs(ll t) {

  if(cnt[t]>0) return cnt[t];

  cnt[t]=mpow(k/t,n);

  ans[t]=0;

  for(ll i=2;i*t<=k;i++) {

    (cnt[t]+=mod-dfs(i*t))%=mod;

  }

  ans[t]=cnt[t]*t%mod;

  return cnt[t];

}



int main() {

  cin >> n >> k;

  ll sum=0;

  dfs(1);

  for(ll i=1;i<=k;i++) {

    (sum+=ans[i])%=mod;

  }

  cout << sum << endl;

}

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef vector<ll> vec;

typedef vector<vec> mat;

typedef pair<ll,ll> pll;

const ll mod=1e9+7;

//const ll mod=998244353;

const ll inf=1LL<<61;



ll mpow(ll x, ll n) {

  ll ans=1;

  while(n>0) {

    if(n&1) {

      ans=ans*x%mod;

    }

    x=x*x%mod;

    n>>=1;

  }

  return ans;

}



int main() {

  ll n,k;

  cin >> n >> k;

  vec c(k+1);

  ll ans=0;

  for(ll i=k;i;i--) {

    c[i]=mpow(k/i,n);

    for(ll j=2;j*i<=k;j++) {

      c[i]=(c[i]-c[j*i]+mod)%mod;

    }

    (ans+=c[i]*i)%=mod;

  }

  cout << ans << endl;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



#define fi first

#define se second

#define pb push_back

#define sz(a) (int)(a).size()

#define mp(a, b) make_pair((a), (b))

using ll = long long;

using pii = pair<int, int>;

using pll = pair<ll, ll>;

using vi = vector<int>;

using vvi = vector<vi>;

using vll = vector<ll>;

using vvll = vector<vll>;



const ll MOD = 1e9 + 7;

const ll INF = 1e18;

const ll IINF = INT_MAX;



const int N = 1e5 + 5;



vi fac[N];

ll cnt[N];



ll fpow(ll a, ll b) {

    if (b == 0) return 1;

    if (b == 1) return a % MOD;

    ll ret = fpow(a, b / 2);

    ret = (ret * ret) % MOD;

    if (b & 1) ret = (ret * a) % MOD;

    return ret;

}



int main() {

    ios::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    int n, k;

    cin >> n >> k;



    for (int i = 1; i <= k; i++) {

        for (ll j = 1; j * j <= 1ll * i; j++) {

            if (i % j == 0) {

                fac[i].pb(j);

                if (j != i / j && j != 1) fac[i].pb(i / j);

            }

        }

    }

    

    ll ans = 0;

    for (int i = k; i >= 1; i--) {

        int banyak = k / i;

        cnt[i] = (cnt[i] + fpow(banyak, n)) % MOD; 

        ans = (ans + 1ll * i * cnt[i]) % MOD;

        // cout << i << ": ";

        for (int fa: fac[i]) {

            // cout << fa << ' ' << cnt[fa] << " | ";

            cnt[fa] = (cnt[fa] - cnt[i] + MOD) % MOD;

            // cout << cnt[fa] << ' ';

        }

        // cout << '\n';

    }

    cout << ans << '\n';

    return 0;

}

// Optimized solution to the same problem (faster):
#include<iostream>

#include<cmath>

#include<cstdio>

#include<algorithm>

#include<queue>

#include<cstring>

#define ll long long

using namespace std;



const ll mod=1e9+7;



ll ksm(ll b,ll p)

{

	ll ans=1;

	while(p>0)

    {

        if(p%2==1)

            ans=(ans*b)%mod;

        b=(b*b)%mod;

        p/=2;

    }

    return ans;

}



ll f[500010],anss;



int main()

{

	int n,k;

	cin>>n>>k;

	for(ll i=k;i>=1;i--)

	{

		ll cnt=k/i;

		f[i]=ksm(cnt,n);

		for(ll j=2*i;j<=k;j+=i)

		{

			f[i]=(f[i]+mod-f[j])%mod;

		}

	}

	for(ll i=1;i<=k;i++)

	{

		anss+=f[i]*i;

		anss%=mod;

	}

	cout<<anss;

        return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<cstring>

using namespace std;

typedef long long ll;

const ll MAXN=1e5+10;

const ll MOD=1e9+7;

ll pri[MAXN],jud[MAXN],phi[MAXN]={0,1},cnt;

ll qpow(ll a,ll b){

    ll res=1,rem=a;

    while(b){

        if(b&1) res=(res*rem)%MOD;

        rem=(rem*rem)%MOD;

        b>>=1;

    }

    return res;

}

void euler(){

    for(ll i=2;i<MAXN;i++){

        if(!jud[i]){

            pri[cnt++]=i;

            phi[i]=(i-1)%MOD;

        }

        for(ll j=0;j<cnt&&i*pri[j]<MAXN;j++){

            jud[i*pri[j]]=1;

            if(i%pri[j]==0){

                phi[i*pri[j]]=phi[i]*pri[j];

                break;

            }

            phi[i*pri[j]]=phi[i]*phi[pri[j]];

        }

    }

}

int main(){

    euler();

    ll n,k;scanf("%lld %lld",&n,&k);

    ll res=0;

    for(ll i=1;i<=k;i++) res=(res+qpow(k/i,n)*phi[i])%MOD;

    printf("%lld\n",res);

    return 0;

}


// Optimized solution to the same problem (faster):
#include<iostream>

#include<cstdio>

#include<cstring>

using namespace std;

typedef long long ll;

const ll MAXN=1e5+10;

const ll MOD=1e9+7;

ll pri[MAXN],jud[MAXN],phi[MAXN]={0,1},cnt;

ll qpow(ll a,ll b){

    ll res=1,rem=a;

    while(b){

        if(b&1) res=(res*rem)%MOD;

        rem=(rem*rem)%MOD;

        b>>=1;

    }

    return res;

}

void euler(ll len){

    for(ll i=2;i<=len;i++){

        if(!jud[i]){

            pri[cnt++]=i;

            phi[i]=(i-1)%MOD;

        }

        for(ll j=0;j<cnt&&i*pri[j]<=len;j++){

            jud[i*pri[j]]=1;

            if(i%pri[j]==0){

                phi[i*pri[j]]=phi[i]*pri[j];

                break;

            }

            phi[i*pri[j]]=phi[i]*phi[pri[j]];

        }

    }

}

int main(){

    ll n,k;scanf("%lld %lld",&n,&k);

    euler(k);

    ll res=0;

    for(ll i=1;i<=k;i++) res=(res+qpow(k/i,n)*phi[i])%MOD;

    printf("%lld\n",res);

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

#include<ext/pb_ds/assoc_container.hpp>

#include<ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;

template<typename T>

using ordered_set = tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define ll long long

#define ff first

#define ss second



ll mod = 1000000007;



ll mulmod(ll a, ll b)

{

    if(b == 0)

        return 0;



    ll x = 0;

    if(b&1)

        x = a;

    ll y = mulmod(a, b/2);



    return ((y+y)%mod + x)%mod;

}



ll BigMod(ll B,ll P,ll M)

{

	ll R=1;

	while(P>0)

	{

		if(P%2==1)

		{

			R=(R*B)%M;

		}

		P/=2;

		B=(B*B)%M;

	}

	return R;

}



ll Extended_Euclidean(ll a,ll b,ll &x,ll &y)

{

    if(b==0)

    {

        x=1;y=0;

        return a;

    }



    ll d;



    d=Extended_Euclidean(b,a%b,y,x);

    y=y-(a/b)*x;



    return d;

}

ll Inverse_Modulo(ll a,ll m)

{

    ll x,y,d;



    d=Extended_Euclidean(a,m,x,y);



    if(d==1)    return (x+m)%m; //Solution Exists

    return -1;  //No Solution

}







ll func(ll r, ll c)

{

    ll i, ret = 0, x = 1;



    ll y = 1;

    for(i = r+c+2; i >= c+2; i--)

        y = (y*i)%mod;



    for(i = 2; i <= r+1; i++)

        x = (x*i)%mod;

//        y = (y*Inverse_Modulo(i, mod))%mod;



//    cout << r << " " << c << " " << y << " " << x << " " << Inverse_Modulo(x, mod) << endl;



    return mulmod(y, Inverse_Modulo(x, mod)) - 1;

}



//void nCr(ll n, ll r)

//{

//    if(r == 0)

//        return 1;

//    if(r == 1)

//        return n%mod;

//    return (nCr(n-1, r-1) + nCr(n-1, r))%mod;

//}





int main()

{

    ll r1, r2, c1, c2, i, ans = 0, x;

    cin >> r1 >> c1 >> r2 >> c2;



    ans = (ans + func(r2, c2))%mod;

    ans = (ans - func(r2, c1-1))%mod;

    ans = (ans - func(r1-1, c2))%mod;

    ans = (ans + func(r1-1, c1-1))%mod;

    ans = (ans + mod) % mod;

    cout << ans;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>

#define mod 1000000007

typedef long long ll;

 

ll rev(ll a) {

  ll b = mod - 2, ans = 1;

  while(b) {

    if(b & 1) ans *= a, ans %= mod;

    b >>= 1, a *= a, a %= mod;

  }

  return ans;

}

 

int main(void) {

  ll i, j, k, r[2], c[2], ans = 0, now;

  scanf("%lld%lld%lld%lld", &r[0], &c[0], &r[1], &c[1]);

  r[0]--, c[0]--;

  ll n = r[1] + c[1], fact[n + 10];

  fact[0] = 1;

  for(i = 1; i <= n + 9; ++i) fact[i] = fact[i - 1] * i, fact[i] %= mod;

  for(i = 0; i < 2; ++i) for(j = 0; j < 2; ++j) {

    now = fact[c[i] + r[j] + 2] * rev(fact[c[i] + 1]);

    now %= mod;

    now *= rev(fact[r[j] + 1]);

    now %= mod;

    ans += now * ((i ^ j) ? -1 : 1) + mod;

    ans %= mod;

  }

  printf("%lld", ans);

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;

typedef long long ll;

ll M = 1000000007LL;

ll inv(ll K) {

  ll A = M - 2;

  ll ret = 1;

  ll D = K;

  while (A > 0) {

    if (A % 2 == 1) {

      ret = (ret * D) % M;

    }

    D = (D * D) % M;

    A /= 2;

  }

  return ret;

}

ll F[2000005];

ll I[2000005];

int main() {

  ios::sync_with_stdio(false);

  ll r1, c1, r2, c2;

  cin >> r1 >> c1 >> r2 >> c2;

  ll ret = 0;

  F[0] = 1;

  I[0] = 1;

  for (ll i = 1; i <= r2+c2+1; i++) {

    F[i] = (F[i-1] * i) % M;

    I[i] = inv(F[i]);

  }

  for (ll i = c1; i <= c2; i++) {

    // sum(f(i+j, i)) = f(i+r2+1, i+1)

    // f(i+r2+1, i+1) = (i+r2+1)! / ((i+1)! * (r2)!)

    ll R = F[i+r2+1];

    //R = (R * inv(F[i+1])) % M;

    //R = (R * inv(F[r2])) % M;

    R = (R * I[i+1]) % M;

    R = (R * I[r2]) % M;

    // sum(f(i+j, i)) = f(r1, i+1)

    // f(i+r1, i) = (i+r1)! / ((i+1)! * (r1-1)!)

    ll L = F[i+r1];

    //L = (L * inv(F[i+1])) % M;

    //L = (L * inv(F[r1-1])) % M;

    L = (L * I[i+1]) % M;

    L = (L * I[r1-1]) % M;

    //cout << R << ' ' << L << endl;

    ret = (ret + R) % M;

    ret = ((ret - L) % M + M) % M;

  }

  cout << ret << endl;

}

// Optimized solution to the same problem (faster):
#include <iostream>

using namespace std;

typedef long long ll;

ll M = 1000000007LL;

ll inv(ll K) {

  ll A = M - 2;

  ll ret = 1;

  ll D = K;

  while (A > 0) {

    if (A % 2 == 1) {

      ret = (ret * D) % M;

    }

    D = (D * D) % M;

    A /= 2;

  }

  return ret;

}

ll F[2000005];

ll I[2000005];

int main() {

  ios::sync_with_stdio(false);

  ll r1, c1, r2, c2;

  cin >> r1 >> c1 >> r2 >> c2;

  ll ret = 0;

  F[0] = 1;

  for (ll i = 1; i <= r2+c2+1; i++) {

    F[i] = (F[i-1] * i) % M;

  }

  I[r2+c2+1] = inv(F[r2+c2+1]);

  for (ll i = r2+c2; i >= 0; i--) {

    I[i] = (I[i+1] * (i+1)) % M;

  }

  for (ll i = c1; i <= c2; i++) {

    // sum(f(i+j, i)) = f(i+r2+1, i+1)

    // f(i+r2+1, i+1) = (i+r2+1)! / ((i+1)! * (r2)!)

    ll R = F[i+r2+1];

    //R = (R * inv(F[i+1])) % M;

    //R = (R * inv(F[r2])) % M;

    R = (R * I[i+1]) % M;

    R = (R * I[r2]) % M;

    // sum(f(i+j, i)) = f(r1, i+1)

    // f(i+r1, i) = (i+r1)! / ((i+1)! * (r1-1)!)

    ll L = F[i+r1];

    //L = (L * inv(F[i+1])) % M;

    //L = (L * inv(F[r1-1])) % M;

    L = (L * I[i+1]) % M;

    L = (L * I[r1-1]) % M;

    //cout << R << ' ' << L << endl;

    ret = (ret + R) % M;

    ret = ((ret - L) % M + M) % M;

  }

  cout << ret << endl;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<string>

#include<cstring>

#include<algorithm>

using namespace std;

typedef long long ll;

const ll mod=1000000007;

ll r1,r2,c1,c2;

ll ans;

ll n;

ll fac[2000005],inv[2000005];

inline void read(ll &x)

{

	ll f;char c;

	for (f=1,c=getchar();c<'0'||c>'9';c=getchar()) if(c=='-') f=-1;

	for (x=0;c<='9'&&c>='0';c=getchar()) x=x*10+(c&15);x*=f;

}

inline ll qpow(ll a,ll b)

{

	ll rest=1;

	while(b)

	{

		if(b&1) rest=(rest*a)%mod;

		b>>=1;

		a=(a*a)%mod;

	}

	return rest;

}

inline ll C(ll n,ll m)

{

	return fac[n]*inv[m]%mod*inv[n-m]%mod;

}

inline ll mx(ll _x,ll _y)

{

	return _x>_y?_x:_y;

}

int main()

{

	read(r1);read(c1);read(r2);read(c2);

	n=mx(r2,c2)*2+1;

	fac[0]=1;

	for(ll i=1;i<=n;i++) 

		fac[i]=fac[i-1]*i%mod;

	inv[n]=qpow(fac[n],mod-2);

	for(ll i=n-1;i>=0;i--) 

		inv[i]=inv[i+1]*(i+1)%mod;

	for(ll i=r1;i<=r2;i++)

	{

		ans=(ans+(C(i+c2+1,i+1)-C(i+c1,i+1))%mod)%mod;

	}

	printf("%lld\n",(ans+mod)%mod);

	return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>

#define N 2222222

#define M 1000000007

typedef long long LL;



LL f[N];



LL qpow(LL x, int y)

{

	if(!y) return 1;

	LL t = qpow(x, y >> 1);

	t = t * t % M;

	if(y & 1) t = t * x % M;

	return t;

}



LL S(int x, int y)

{

	LL ans = f[x + y + 2];

	ans = ans * qpow(f[y + 1], M - 2) % M;

	ans = ans * qpow(f[x + 1], M - 2) % M;

	return ans - 1;

}



int main() 

{

	int r1, c1, r2, c2, m, i, j;

	LL sum;

		

	scanf("%d%d%d%d", &r1, &c1, &r2, &c2);

	m = r2 + c2 + 2;

	for(i = 2, f[0] = f[j = 1] = 1; i <= m; j = i++){

		f[i] = f[j] * (LL)i % M;

	}

	sum = S(r2, c2) - S(r1 - 1, c2);

	if(sum < 0) sum += M;

	sum -= S(r2, c1 - 1);

	if(sum < 0) sum += M;

	sum += S(r1 - 1, c1 - 1);

	if(sum >= M) sum -= M;

	printf("%lld\n", sum);

		

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
// writer: w33z8kqrqk8zzzx33

#include <bits/stdc++.h>

using namespace std;

 

#define iter(i, a, b) for(int i=(a); i<(b); i++)

#define rep(i, a) iter(i, 0, a)

#define rep1(i, a) iter(i, 1, (a)+1)

#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl

#define all(a) a.begin(), a.end()

#define fi first

#define se second

#define pb push_back

#define mp make_pair

 

using ll=long long;

using pii=pair<int, int>;

//#define int ll

const int MOD = 1000000007;



int fac[2000006], inv[2000006], invfac[2000006];



int calc(int r, int c) {

    // -1 + r+c+2 choose r+1

    return ((1ll * fac[r+c+2] * invfac[r+1] % MOD * invfac[c+1] % MOD) + MOD - 1) % MOD;

}



signed main() {

    ios_base::sync_with_stdio(false); cin.tie(0);

    int r1, c1, r2, c2; cin >> r1 >> c1 >> r2 >> c2;

    fac[0] = 1; invfac[0] = 1;

    inv[0] = 1; inv[1] = 1;

    rep1(i, r2+c2+2) {

        if(i != 1) inv[i] = 1ll * inv[MOD % i] * (MOD - MOD/i) % MOD;

        fac[i] = 1ll * fac[i-1] * i % MOD;

        invfac[i] = 1ll * invfac[i-1] * inv[i] % MOD;

    }

    cout << (4ll*MOD + calc(r2, c2) - calc(r1-1, c2) - calc(r2, c1-1) + calc(r1-1, c1-1)) % MOD << endl;

}




// Optimized solution to the same problem (faster):
#include <stdio.h>

#define N 2222222

#define M 1000000007

typedef long long LL;



LL f[N];



LL qpow(LL x, int y)

{

	if(!y) return 1;

	LL t = qpow(x, y >> 1);

	t = t * t % M;

	if(y & 1) t = t * x % M;

	return t;

}



LL S(int x, int y)

{

	LL ans = f[x + y + 2];

	ans = ans * qpow(f[y + 1], M - 2) % M;

	ans = ans * qpow(f[x + 1], M - 2) % M;

	return ans - 1;

}



int main() 

{

	int r1, c1, r2, c2, m, i, j;

	LL sum;

		

	scanf("%d%d%d%d", &r1, &c1, &r2, &c2);

	m = r2 + c2 + 2;

	for(i = 2, f[0] = f[j = 1] = 1; i <= m; j = i++){

		f[i] = f[j] * (LL)i % M;

	}

	sum = S(r2, c2) - S(r1 - 1, c2);

	if(sum < 0) sum += M;

	sum -= S(r2, c1 - 1);

	if(sum < 0) sum += M;

	sum += S(r1 - 1, c1 - 1);

	if(sum >= M) sum -= M;

	printf("%lld\n", sum);

		

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <fstream>

#include <sstream>

#include <iomanip>

#include <algorithm>

#include <numeric>

#include <vector>

#include <string>

#include <set>

#include <map>

#include <queue>

#include <stack>

#include <climits>

#include <cmath>

#include <cstring>

#include <unordered_set>

#include <unordered_map>

using namespace std;



#define pb push_back

#define fst first

#define snd second



typedef long long ll;

typedef pair<int,int> pii;

template<typename T> using min_queue=priority_queue<T,vector<T>,greater<T>>;



const ll MOD=1e9+7;



int N,K;



inline ll pw(ll a, ll b) {

  a%=MOD;

  ll res=1;

  for(;b;b>>=1) {

    if (b&1) res=res*a%MOD;

    a=a*a%MOD;

  }

  return res;

}





ll fac[4020],ifac[4020];



inline ll choose(int a, int b) {

  if (b<0 || b>a) return 0;

  return fac[a]*ifac[b]%MOD*ifac[a-b]%MOD;

}



int main(){

  ios::sync_with_stdio(0);cin.tie(0);



  cin>>N>>K;



  fac[0]=ifac[0]=1;

  for(int i=1;i<=4001;i++) fac[i]=fac[i-1]*i%MOD, ifac[i]=pw(fac[i],MOD-2);



  for(int i=1;i<=K;i++) cout<<choose(K-1,i-1)*choose(N-K+1,i)%MOD<<endl;



  return 0;

}


// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

const int inf=7+1e9,maxn=5+2e4;

typedef unsigned long long ll;

ll dp[maxn];

ll qpow(ll a,ll p){

	ll ans=1,tmp=a;

	while(p){

		if(p&1)

			ans=ans*tmp%inf;

		tmp=tmp*tmp%inf;

		p>>=1;	

	}

	return ans;

}

ll C(ll m,ll n){

	return dp[n]*qpow(dp[m]*dp[n-m]%inf,inf-2)%inf;

}

int main(){

	ll n,k;

	cin>>n>>k;

	//BLUE:C(i-1,k-1);RED:C(i,n-k+1);T0TAL:C(i,k-1)*C(i,n-k+1)

	//5 3

	//1:C(0,2)*C(1,3)=3;2:C(1,2)*C(2,3)=2*3=6;C(2,2)*C(3,3)=1

	memset(dp,0,sizeof(dp));

	dp[0]=1;

	for(ll i=1;i<=2005;i++)

		dp[i]=dp[i-1]*i%inf;

	/*

	for(ll i=1;i<=2000;i++)

		cout<<"dp["<<i<<"]="<<dp[i]<<endl;		

	*/

	for(ll i=1;i<=k;i++){

		if(i-1>n-k)

			cout<<"0\n";

		else	

			cout<<C(i-1,k-1)*C(i,n-k+1)%inf<<endl;

	}

		

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define endl '\n'

#define f first

#define s second

#define point complex<double>

#define pi acos(-1)

#define ld long double

using namespace std;

typedef long long ll;

const int xd=1e6;

const ll mod=1e9+7;

double dot(point a,point b)

{

    return (conj(a)*b).real();

}

double cross(point a,point b)

{

    return (conj(a)*b).imag();

}





ll fact[1000006], inv[1000006];



ll fp(ll base, ll exp)

{

    if (exp == 0)

        return 1;

    ll ans = fp(base, exp / 2);

    ans = (ans * ans) % mod;

    if (exp % 2 != 0)

        ans = (ans * (base % mod)) % mod;

    return ans;

}



void calcFacAndInv(ll n)

{

    fact[0] = inv[0] = 1;

    for (ll i = 1; i <= n; i++)

    {

        fact[i] = (i * fact[i - 1]) % mod;

        inv[i] = fp(fact[i], mod - 2);

    }

}



ll ncr(ll n, ll r)

{

    return ((fact[n] * inv[r]) % mod * inv[n - r]) % mod;

}



ll npr(ll n, ll r)

{

    return (fact[n] * inv[n - r]) % mod;

}

int main()

{

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    cout.tie(NULL);

calcFacAndInv(10000);

int n,b,r;

ll ansb,ansa;

cin>>n>>b;

r=n-b;

for(int i=1;i<=b;i++){

        if(r+1<i){

            cout<<0<<endl;

            continue;

        }

ansb=ncr(b-1,i-1)%mod;

ansa=ncr(r+1,i)%mod;

cout<<(ansb*ansa)%mod<<endl;;

}



    return 0;

}


// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

const int inf=7+1e9,maxn=5+2e4;

typedef unsigned long long ll;

ll dp[maxn];

ll qpow(ll a,ll p){

	ll ans=1,tmp=a;

	while(p){

		if(p&1)

			ans=ans*tmp%inf;

		tmp=tmp*tmp%inf;

		p>>=1;	

	}

	return ans;

}

ll C(ll m,ll n){

	return dp[n]*qpow(dp[m]*dp[n-m]%inf,inf-2)%inf;

}

int main(){

	ll n,k;

	cin>>n>>k;

	//BLUE:C(i-1,k-1);RED:C(i,n-k+1);T0TAL:C(i,k-1)*C(i,n-k+1)

	//5 3

	//1:C(0,2)*C(1,3)=3;2:C(1,2)*C(2,3)=2*3=6;C(2,2)*C(3,3)=1

	memset(dp,0,sizeof(dp));

	dp[0]=1;

	for(ll i=1;i<=2005;i++)

		dp[i]=dp[i-1]*i%inf;

	/*

	for(ll i=1;i<=2000;i++)

		cout<<"dp["<<i<<"]="<<dp[i]<<endl;		

	*/

	for(ll i=1;i<=k;i++){

		if(i-1>n-k)

			cout<<"0\n";

		else	

			cout<<C(i-1,k-1)*C(i,n-k+1)%inf<<endl;

	}

		

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

#define ll long long

const ll mod=1e9+7;

const int maxn=2e5+10;

ll inv[maxn];

ll fac[maxn];

ll power(ll base,ll n)

{

    ll r=1;

    while(n)

    {

        if(n&1) r=r*base%mod;

        base=base*base%mod;

        n/=2;

    }

    return r;

}

void init()

{

    fac[0]=1;

    for(int i=1;i<=2e5;i++)

    {

        fac[i]=fac[i-1]*i%mod;

    }

    inv[200000]=power(fac[200000],mod-2);

    for(int i=2e5;i>=1;i--)

    {

        inv[i-1]=inv[i]*i%mod;

    }

}

ll C(ll m,ll n)

{

    return fac[n]*inv[m]%mod*inv[n-m]%mod;

}



int main()

{

    ios::sync_with_stdio(false);

    cin.tie(0);

    int n,k;

    cin>>n>>k;

    init();





    int red=n-k;

    for(int i=1;i<=k;i++)

    {

        if(i>red+1)

        {

            cout<<0<<'\n';

            continue;

        }

        int ans=(C(i,red+1)*C(i-1,k-1))%mod;

        cout<<ans<<'\n';

    }





}


// Optimized solution to the same problem (faster):
#include <iostream>

#include <bits/stdc++.h>

#define p 1000000007

using namespace std;

int N,k;





const int A = 2e5 + 11;

const int B = 1e6 + 11;

const int inf = 0x3f3f3f3f;



inline int read() {

	char c = getchar(); int x = 0, f = 1;

	for( ; !isdigit(c); c = getchar()) if(c == '-') f = -1;

	for( ; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);

	return x * f;

}



int T, fac[A];



inline int power(long long a, long long  b) {

	long long res = 1;

	while (b) {

		if (b & 1) res = res * a % p;

		a = a * a % p, b >>= 1;

	}

	return res;

}



inline int C(int n, int m) {

	if (m > n) return 0;



	return (1LL*fac[n] * power(fac[m], p - 2) % p) *  power(fac[n - m], p - 2) % p;

}



inline int Lucas(int n, int m) {

	if (!m) return 1;

	//cout <<"CL:"<<C(n%p,m%p) << " "<<Lucas(n / p, m / p)<<endl;

	return C(n % p, m % p) * Lucas(n / p, m / p) % p;

}



inline void init() {

	int maxn = N*2;

	fac[0] = 1;

	for (int i = 1; i <= maxn; i++) fac[i] = (1LL*fac[i - 1] * i) % p;

}





int main()

{

    scanf("%d%d",&N,&k);

    long long b = k,r = N-k;

    init();



    for(int i=1;i<=k;++i)

    {

        long long i1 = 1,i2 = 1;

        if(r-i+1<0) {

            printf("0\n");continue;

        }

        i1 = Lucas(k-1,k-i);

        //cout << k << " "<<i<<" "<<i1 << endl;

        i2 = Lucas(r+1,r-i+1);

        //cout <<r+1<<" "<<r-i+1<<" "<<i2<<endl;

        printf("%lld\n",(1LL*i1*i2)%p);

    }

    return 0;

}


// Fastest known solution for this problem: