#include using namespace std; using ll = long long; using vi = vector; using pii = pair; using pll = pair; using vvi = vector; #define f(i,a,b) for(int i = (a); i < (b); i++) #define rep(i,a,b) for(int i = (a); i < (b); i++) #define pb emplace_back #define PB push_back #define all(x) (x).begin(), (x).end() #define sz(x) (int)(x).size() #define dump(x) cout << #x << "=" << x << endl; #define int long long const int mod = 1000000007; vvi mul(vvi &a,vvi &b,int n) { vvi ans(n, vi(n,0)); f(i,0,n) f(k,0,n) { f(j,0,n) { ans[i][j]+=((a[i][k] % mod) * (b[k][j] % mod)) % mod; ans[i][j] = ans[i][j] % mod; } } return ans; } vvi pow(vvi &base, int p, int n) { vvi ans(n, vi(n, 0)); f(i,0,n) f(j,0,n) if(i==j) ans[i][j] = 1; while(p) { if(p&1) ans = mul(ans, base, n); base = mul(base, base, n); /* f(i,0,n) { f(j,0,n) cout << base[i][j]; cout << endl; } cout << "base\n"; cout << "-----\n";*/ p >>=1; } return ans; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); int k, n; cin >> k >>n; vi vals(k, 1); vvi mat(k, vi(k,0)); f(i,0,k) f(j,0,k) { int ii, jj; ii = i +1; jj = j+1; int g = __gcd(ii,jj); int should = g == 1; mat[i][j] = should; } vi new_vals(k, 0); f(i,0,k) new_vals [i] = vals[i]; if (n>1) { mat = pow(mat, n-1, k); f(i,0,k) new_vals[i] = 0; f(i,0,k) f(j,0,k) { new_vals[i] += (mat[i][j] * vals[j]) % mod; new_vals[i] = new_vals[i]%mod; } } ll out = 0; f(i,0,k) { out += new_vals[i]; out = out % mod; } cout << out << '\n'; return 0; }