#include <bits/stdc++.h>
const long long mod = 1000000007;
long long f[2010][2010];
int n, m;
long long ans;
int main() {
  int i, j;
  long long t;
  scanf("%d%d", &n, &m);
  for (i = 0; i <= m; i++) f[0][i] = 1;
  for (i = 1; i <= n; i++) {
    for (j = 0; j <= m; j++) {
      if (j < 2)
        f[i][j] = 1;
      else
        f[i][j] = (f[i - 1][j] + f[i][j - 1] + f[i][j - 1] - f[i][j - 2]) % mod;
      if (f[i][j] < 0) f[i][j] += mod;
    }
  }
  ans = 0;
  for (i = 1; i <= n; i++) {
    for (j = 2; j <= m; j++) {
      t = (f[i - 1][j - 1] + f[i - 1][j - 1] - f[i - 1][j - 2]) % mod;
      if (t < 0) t += mod;
      ans = (ans + t * f[n - i][j] % mod * (m - j + 1) % mod) % mod;
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
