#include <bits/stdc++.h>

using namespace std;
using namespace std::chrono;

#define rep(i,a,b) for(int i = a;i<(b);++i)
#define trav(a,v) for(auto& a : v)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;

const ll big = 1000000007ll;
const ll big2 = 1000000009ll;
ll n,m,k,q,w,h,T;

ll DP[2001][2001][3] = {0};
bool DPC[2001][2001][3] = {0};

ll FAC[5000] = {0};
ll INV[5000] = {0};

ll CSA[2001][2001] = {0};
ll CSB[2001][2001] = {0};

ll mod(ll i){
    if(i<0)return mod(big-mod(-i));
    if(i<big)return i;
    return i%big;
}

ll upp(ll i, ll j){
    if(j == 0)return 1;
    if(j%2 == 0){
        ll h = upp(i,j/2);
        return mod(h*h);
    }
    return mod(i*upp(i,j-1));
}

ll bin(ll i, ll j){
    if(i < 0 || j < 0 || i < j)return 0;
    return mod(FAC[i]*mod(INV[j]*INV[i-j]));
}

void setup(){
    ll t = 1;
    for(ll c1 =0 ; c1 < 5000; c1++){
        FAC[c1] = t;
        INV[c1] = upp(t,big-2);
        t *= c1+1;
        t = mod(t);
    }

    for(ll c1 = 0; c1 < 2001; c1++){
        CSA[c1][0] = 1;
        for(ll c2 = 1; c2 < 2001; c2++){
            CSA[c1][c2] = mod(CSA[c1][c2-1] + bin(c1,c2));
        }
    }

    for(ll c1 = 0; c1 < 2001; c1++){
        CSB[c1][0] = 1;
        for(ll c2 = 1; c2 < 2001; c2++){
            CSB[c1][c2] = mod(CSB[c1][c2-1] + CSA[c1][c2]);
        }
    }

}

ll dp(ll a, ll b, ll era){
    if(a < 0 || b < 0)return 0;
    if(a*b*era == 0)return 1;
    if(era == 1)return CSB[b-1][a];
    if(DPC[a][b][era])return DP[a][b][era];
    ll ans = dp(a-1,b,era);
    for(ll c1 = 0; c1 < b; c1++){
        ans += bin(b-1,c1)*dp(a-c1,c1,1);
        ans = mod(ans);
    }
    DPC[a][b][era] = 1;
    DP[a][b][era] = ans;
    return ans;
}

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("autput.txt","w",stdout);
    ll a,b,c,d;

    setup();
    cin >> n >> m;
    cout << dp(n,m,2) << "\n";

    return 0;
}
