#include <iostream>
#include <vector>
using namespace std;
int main() {
int m, n;
cin >> n >> m;
//cout << n << m << endl;
//计算anm
vector<vector<long long>> a(n + 1, vector<long long>(m + 1));
a[1][1] = 1; // 这样就可以正确赋值了
for (int i =2; i<=n; i++) {
a[i][1]=1;
//a[i][1]=a[i-1][1];
}
for (int i =2; i<=m; i++) {
a[1][i]=1;
//a[1][i]=a[1][i-1];
}
for (int i=2; i<=n; i++) {
for (int j=2; j<=m; j++) {
a[i][j] = (a[i-1][j] + a[i][j-1]) % 1000000007;//每次取模能防止中间结果溢出,这是因为取模运算具有分配律性质,对于加法运算满足:
//(a + b) % mod = [(a % mod) + (b % mod)] % mod
}
}
cout<<a[n][m]<<endl;
}