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