#include <bits/stdc++.h>
using namespace std;
long long n, m;
const int Mod = 1e9 + 7;
long long f[2010][2010], sum[2010][2010], ans;
int main() {
  cin >> n >> m;
  for (int i = 2; i <= m; i++) f[1][i] = 1, sum[1][i] = sum[1][i - 1] + 1;
  for (int i = 2; i <= n; i++) {
    f[i][1] = 1;
    for (int j = 2; j <= m; j++) {
      f[i][j] = (f[i][j - 1] + sum[i - 1][j]) % Mod;
      sum[i][j] = (sum[i][j - 1] + f[i][j]) % Mod;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 2; j <= m; j++) {
      long long pre = (f[i][j] - f[i - 1][j] + Mod) % Mod;
      long long nxt = f[n - i + 1][j];
      (ans += pre * nxt % Mod * (m - j + 1) % Mod) %= Mod;
    }
  }
  cout << ans;
  return 0;
}
