#include <iostream>
using namespace std;
const int mod=1e9+7;
long long a[1005][1005];

int main() {
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
         if(i==1&&j==1){
            a[i][j]=1;
            
         }else if (i==1){
            a[i][j]=(a[i][j-1])%mod;
         }else if(j==1){
            a[i][j]=(a[i-1][j])%mod;
         }else{a[i][j]=(a[i-1][j]+a[i][j-1])%mod;}
        }
    }
    cout<<a[n][m]%mod;
    return 0;
}