#include <bits/stdc++.h>
using namespace std;
const int maxN = 2000 + 10, MOD = int(1e9 + 7);
int m, n;
long long f[maxN][maxN], g[maxN][maxN];
int main() {
  scanf("%d%d", &n, &m);
  if (m < 2) {
    printf("0\n");
    return 0;
  }
  memset(f, 0, sizeof f);
  long long s;
  for (int i = 1; i <= n; i++) {
    s = 0;
    f[i][1] = 1;
    for (int j = 2; j <= m; j++) {
      g[i][j] = (f[i][j - 1] + s) % MOD;
      s = (s + f[i - 1][j]) % MOD;
      f[i][j] = (f[i][j - 1] + s) % MOD;
    }
    f[i][1] = 0;
  }
  long long res = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 2; j <= m; j++) {
      s = (f[i][j] * g[n - i + 1][j]) % MOD;
      s = (s * (m - j + 1)) % MOD;
      res = (res + s) % MOD;
    }
  printf("%I64d\n", res);
  return 0;
}
