#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace atcoder; typedef long long ll; typedef long double ld; typedef std::pair pii; typedef std::pair pil; typedef std::pair pli; typedef std::pair pll; typedef std::pair pid; typedef std::pair pis; typedef std::pair pls; typedef std::vector vb; typedef std::vector vvb; typedef std::vector vi; typedef std::vector vvi; typedef std::vector vvvi; typedef std::vector vvvvi; typedef std::vector vl; typedef std::vector vvl; typedef std::vector vvvl; typedef std::vector vvvvl; typedef std::vector vd; typedef std::vector vvd; typedef std::vector vs; #define rep(i,n) for(auto i=0; i=0; --i) #define repdm(i,e,n) for(auto i=n-1; i>=e; --i) #define all(a) (a).begin(), (a).end() #define rall(a) (a).rbegin(), (a).rend() template inline bool chmax(T& a, T b, int eq = 0) { if (a < b || (a == b && eq)) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b, int eq = 0) { if (a > b || (a == b && eq)) { a = b; return 1; } return 0; } template * = nullptr> constexpr istream& operator>>(istream& is, mint& x) noexcept {long long v = 0; std::cin >> v; x = v; return is;} template * = nullptr> constexpr ostream& operator<<(ostream& os, const mint& x) noexcept {os << x.val(); return os;} inline void _n() { std::cout << std::endl; } template inline void _(const T a) { std::cout << a; } template inline void _l(const T a) { _(a); _n(); } template inline void _s(const T a) { _(a); _(' '); } template inline void _v(const std::vector v) { for(auto a : v) _(a); } template inline void _vl(const std::vector v) { for(auto a : v) _l(a); } template inline void _vs(const std::vector v) { for(auto a : v) _s(a); _n(); } template inline void _vvl(const std::vector> v) { for(auto a : v) { _v(a); _n(); } } template inline void _vvs(const std::vector> v) { for(auto a : v) { _vs(a); } } inline void ynl(const bool b) {_l(b ? "yes" : "no");} inline void yns(const bool b) {_l(b ? "Yes" : "No");} inline void ynu(const bool b) {_l(b ? "YES" : "NO");} constexpr int INF = numeric_limits::max() >> 1; constexpr long long INF_LL = numeric_limits::max() >> 1LL; constexpr long long MOD1 = 1000000007; constexpr long long MOD9 = 998244353; using mint1 = atcoder::modint1000000007; using mint9 = atcoder::modint998244353; //* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *// struct cmb_mod { using mint = atcoder::modint; public: cmb_mod(long long n, long long m) : _n(n), _mod(m) { init(); } long long factorial(long long n) { assert(0 <= n && n <= _n); mint res = fac[n].val(); return res.val(); }; long long factorial_inv(long long n) { assert(0 <= n && n <= _n); mint res = finv[n].val(); return res.val(); }; long long permutation(long long n, long long k) { assert(0 <= n && n <= _n); assert(0 <= k && k <= n); mint res = fac[n] * finv[n-k]; return res.val(); }; long long combination(long long n, long long k) { assert(0 <= n && n <= _n); assert(0 <= k && k <= n); mint res = fac[n] * finv[k] * finv[n-k]; return res.val(); }; long long combination_with_repetition (long long n, long long k) { return combination(n+k-1, k); }; long long multinomial_coefficient (long long n, std::vector kv) { assert(0 <= n && n <= _n); long long ks = 0; for(auto a : kv) { assert(0 <= a && a <= _n); ks += a; } assert(n == ks); mint res = fac[n]; for(auto a : kv) { res *= finv[a]; } return res.val(); } private: long long _n; long long _mod; std::vector fac; std::vector finv; void init () { assert(0 <= _n); assert(1 <= _mod); mint::set_mod((int)_mod); fac.resize(_n+1, mint(0)); finv.resize(_n+1, mint(0)); fac[0] = mint(1); for(long long i = 1 ; i <= _n ; ++i) { fac[i] = fac[i-1] * mint(i); } finv[_n] = atcoder::inv_mod(fac[_n].val(), _mod); for(long long i = _n - 1 ; i > -1 ; --i) { finv[i] = finv[i+1] * (i+1); } } }; void solve() { int N, M; cin >> N >> M; cmb_mod cmb(M, MOD1); mint1 ans = 0; repm(i, N, M+1) { ans += cmb.combination(i, N); } _l(ans); } //* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *// int main() { std::ifstream in("input.txt"); std::cin.rdbuf(in.rdbuf()); std::cin.tie(0); std::cout.tie(0); std::ios::sync_with_stdio(false); solve(); return 0; }