#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 2000 + 10;
const int MOD = 1000000000 + 7;
int N, M;
long long f[MAX_N][MAX_N], g[MAX_N][MAX_N], c[MAX_N][MAX_N];
long long l1[MAX_N][MAX_N], l2[MAX_N][MAX_N];
void solve() {
  cin >> N >> M;
  for (int j = 0; j <= M; ++j) g[0][j] = 1;
  for (int i = 1; i <= N; ++i)
    for (int j = 2; j <= M; ++j) {
      c[i][j] = g[i - 1][j];
      f[i][j] = (f[i][j - 1] + c[i][j]) % MOD;
      g[i][j] = (g[i][j - 1] + f[i][j]) % MOD;
    }
  for (int j = 2; j <= M; ++j)
    for (int i = 1; i <= N; ++i) {
      l1[i][j] = (l1[i - 1][j] + c[i][j]) % MOD;
      l2[i][j] = (l2[i - 1][j] + g[i][j]) % MOD;
    }
  long long ret = 0;
  for (int i = 1; i <= N; ++i)
    for (int j = 2; j <= M; ++j)
      ret = (ret + l1[i][j] * (l2[N - i][j] + 1 - l1[N - i][j] + MOD) % MOD *
                       (M - j + 1)) %
            MOD;
  cout << ret << endl;
}
int main() {
  solve();
  return 0;
}
