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