# codeforces 295D Greg and Caves

  for (i=2;i<=m;i++){
for (j=1;j<=n;j++)
for (k=0;k<=j;k++)
g[i][j]=(g[i][j]+(LL)f[i][k]*h[i][j-k]%Mod)%Mod;
}

double暴精度了T_T。。。。。

#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
typedef long long LL;
const int Mod=(1e9)+7;
int n,m,ans,i,j,k,tmp,f[2005][2005];
int sum[2005][2005],h[2005][2005];

int main(){
//freopen("295D.in","r",stdin);
//freopen("295D.out","w",stdout);
scanf("%d%d",&n,&m);

for (i=2;i<=m;i++){
f[i][1]=1;
sum[i][1]=i-1;
}
for (i=2;i<=n;i++)
for (j=2;j<=m;j++){
f[j][i]=(f[j-1][i]+sum[j][i-1])%Mod;
sum[j][i]=(f[j][i]+sum[j-1][i])%Mod;
}
memset(sum,0,sizeof(sum));
for (i=1;i<=n;i++)
for (j=m;j>0;j--){
f[j][i]=(LL)f[j][i]*(m-j+1)%Mod;
sum[j][i]=(sum[j+1][i]+f[j][i])%Mod;
}

for (i=2;i<=n;i++){
for (j=m;j>1;j--)
h[j][i]=(h[j+1][i]+sum[j][i-1])%Mod;
for (j=m;j>1;j--)
h[j][i]=(h[j][i]-f[j][i-1]+Mod)%Mod;
}
memset(sum,0,sizeof(sum));
for (i=2;i<=n;i++)
for (j=m,tmp=0;j>1;j--){
tmp=(tmp+sum[j][i-1])%Mod;
h[j][i] = ( h[j][i]+tmp )%Mod;
sum[j][i] = ( sum[j+1][i]+h[j][i] )%Mod;
}

for (i=1;i<=m;i++)
for (j=1;j<=n;j++){
ans=(ans+(LL)f[i][j]*(n-j+1)%Mod)%Mod;
ans=(ans+(LL)h[i][j]*(n-j+1)%Mod)%Mod;
}
printf("%d\n",ans);
return 0;
}