#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int n, m;
long long dp[2008][2005];
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 2; i <= m; ++i) {
    dp[1][i] = 1;
  }
  for (int i = 2; i <= n; ++i) {
    long long tmp = 0;
    dp[i][1] = 1;
    for (int j = 2; j <= m; ++j) {
      tmp = (tmp + dp[i - 1][j]) % mod;
      dp[i][j] = (dp[i][j - 1] + tmp) % mod;
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = 2; j <= m; ++j)
      ans = (ans + (dp[i][j] - dp[i - 1][j] + mod) % mod * dp[n - i + 1][j] %
                       mod * (m - j + 1) % mod) %
            mod;
  printf("%lld\n", ans);
  return 0;
}
