#include <bits/stdc++.h>
using namespace std;
const int maxN = 2000 + 5;
const long long mod = 1000 * 1000 * 1000 + 7;
long long d[maxN][maxN];
long long b[maxN][maxN];
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  if (m < 2) {
    cout << 0 << endl;
    return 0;
  }
  for (int j = 0; j <= m - 2; j++) b[1][j] = d[1][j] = 1;
  for (int i = 2; i <= n; i++) {
    long long sum = 0;
    for (int j = 0; j <= m - 2; j++) {
      sum += d[i - 1][j];
      sum %= mod;
      d[i][j] = (sum + d[i][j - 1]) % mod;
      b[i][j] += d[i][j] + b[i - 1][j];
      b[i][j] %= mod;
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= m - 2; j++)
      ans += ((((b[i][j] - b[i - 1][j]) * (b[n - i + 1][j])) % mod) *
              (m - 1 - j)) %
             mod,
          ans %= mod;
  if (ans < 0) ans += mod;
  cout << ans << endl;
  return 0;
}
