#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; #define MOD 1000000007 // x^n ll mod_pow(ll x, ll n) { if (n == 0) return 1; ll res = mod_pow(x * x % MOD, n / 2); if (n & 1) res = res * x % MOD; return res; } // x^{-1} ll mod_inv(ll x) { return mod_pow(x, MOD - 2); } vector fact; vector fact_inv; void init_fact(int n) { fact.resize(n + 1); fact_inv.resize(n + 1); fact[0] = fact_inv[0] = 1; for (int i = 0; i < n; ++i) { fact[i + 1] = fact[i] * (i + 1) % MOD; fact_inv[i + 1] = fact_inv[i] * mod_inv(i + 1) % MOD; } } ll nCr(ll n, ll r) { if (n < r || n < 0 || r < 0) return 0; return fact[n] * fact_inv[r] % MOD * fact_inv[n - r] % MOD; } ll nPr(ll n, ll r) { return nCr(n, r) * fact[r] % MOD; } int main() { int n, m; cin >> n >> m; init_fact(m); ll ans = 0; for (int i = n; i <= m; ++i) { ll res = fact[i]; res = (res * fact_inv[n]) % MOD; res = (res * fact_inv[i - n]) % MOD; ans = (ans + res) % MOD; } cout << ans << endl; return 0; }