#include <bits/stdc++.h>
using namespace std;
long long re() {
  long long ret = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) f = (ch == '-') ? -f : f, ch = getchar();
  while (isdigit(ch)) ret = ret * 10 + ch - '0', ch = getchar();
  return ret * f;
}
const long long MOD = 1e9 + 7;
long long n, m, f[2005][2005], sum1[2005][2005], sum2[2005][2005],
    sum3[2005][2005], ans;
signed main() {
  n = re(), m = re();
  for (long long i = 1; i <= n; ++i)
    for (long long j = 2; j <= m; ++j)
      f[i][j] = (sum2[i - 1][j] + 1) % MOD,
      sum1[i][j] = (sum1[i][j - 1] + f[i][j]) % MOD,
      sum2[i][j] = (sum2[i][j - 1] + sum1[i][j]) % MOD;
  for (long long i = 1; i <= n; ++i)
    for (long long j = 2; j <= m; ++j)
      ans +=
          (f[i][j] - f[i - 1][j]) * f[n - i + 1][j] % MOD * (m - j + 1) % MOD,
          ans %= MOD;
  printf("%lld\n", ans + (ans < 0) * MOD);
  return 0;
}
