/** * @FileName a.cpp * @Author kanpurin * @Created 2020.07.28 20:45:29 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; long long powMod(long long k, long long n, long long mod) { long long x = 1; while (n > 0) { if (n & 1) { x = x * k % mod; } k = k * k % mod; n >>= 1; } return x; } long long comb(ll n, ll r, ll mod) { long long ret = 1; while (true) { if (r == 0) break; long long N = n % mod; long long R = r % mod; if (N < R) return 0; for (int i = 0; i < R; i++) { ret = ret * (N - i) % mod; } long long imul = 1; for (int i = 0; i < R; i++) { imul = imul * (i + 1) % mod; } ret = ret * powMod(imul, mod - 2, mod) % mod; n /= mod; r /= mod; } return ret; } int main() { int n, m; cin >> n >> m; int MOD = 1e9 + 7; cout << comb(m + 1, n + 1, MOD) << endl; return 0; }