#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long n, m, sum, ans, f[2010][2010];
inline long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + (c ^ '0');
    c = getchar();
  }
  return x * f;
}
int main() {
  n = read();
  m = read();
  for (int i = 1; i <= m; i++) f[1][i] = 1;
  for (int i = 2; i <= n; i++) {
    sum = 0;
    f[i][1] = 1;
    for (int j = 2; j <= m; j++) {
      sum = (sum + f[i - 1][j]) % mod;
      f[i][j] = (f[i][j - 1] + sum) % mod;
    }
  }
  for (int i = 1; i <= n; i++)
    for (int j = 2; j <= m; j++)
      ans = (ans + (f[i][j] - f[i - 1][j]) * f[n - i + 1][j] % mod *
                       (m - j + 1) % mod) %
            mod;
  printf("%lld", (ans + mod) % mod);
  return 0;
}
