#include #include #include #include #include #define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define FOR(i,m,n) for(int i=(m);i<(n);++i) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() const int INF = 0x3f3f3f3f; const long long LINF = 0x3f3f3f3f3f3f3f3fLL; const double EPS = 1e-8; const int MOD = 1000000007; // 998244353; const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1}; /*-------------------------------------------------*/ long long mod_inv(long long a, long long mod = MOD) { a %= mod; if (__gcd(a, mod) != 1) return -1; long long b = mod, x = 1, y = 0; while (b > 0) { long long tmp = a / b; a -= tmp * b; swap(a, b); x -= tmp * y; swap(x, y); } x %= mod; if (x < 0) x += mod; return x; } const int MAX = 10000000; long long fact[MAX + 1], fact_inv[MAX + 1]; void nCk_init(int val = MAX, long long mod = MOD) { fact[0] = 1; FOR(i, 1, val + 1) fact[i] = fact[i - 1] * i % mod; fact_inv[val] = mod_inv(fact[val], mod); for (int i = val; i > 0; --i) fact_inv[i - 1] = fact_inv[i] * i % mod; } long long nCk(int n, int k, long long mod = MOD) { if (n < 0 || n < k || k < 0) return 0; return fact[n] * fact_inv[k] % mod * fact_inv[n - k] % mod; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); // freopen("input.txt", "r", stdin); int n, k; cin >> n >> k; nCk_init(n); vector dp(n + 1, 0); vector ok(n + 1, false); FOR(i, 1, n + 1) { if (n % i == 0) { int t = n / __gcd(i, n); if (k % t == 0) { (dp[i] = nCk(n / t, k / t)) %= MOD; ok[i] = true; } } } FOR(i, 1, n + 1) if (ok[i]) { for (int j = i * 2; j <= k; j += i) { if (ok[j]) (dp[j] += MOD - dp[i]) %= MOD; } } long long ans = 0; FOR(i, 1, n + 1) (ans += dp[i]) %= MOD; cout << ans << '\n'; return 0; }