#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int n, m;
int dp[2005][2005];
int sum1[2005][2005], sum2[2005][2005];
int main() {
  scanf("%d%d", &n, &m);
  memset(dp, 0, sizeof(dp));
  for (int i = 1; i <= n; i++) {
    int s = 0;
    for (int j = 2; j <= m; j++) {
      sum1[i][j] = sum2[i - 1][j] + 1;
      if (sum1[i][j] >= mod) sum1[i][j] -= mod;
      s += sum1[i][j];
      if (s >= mod) s -= mod;
      sum2[i][j] = sum2[i][j - 1] + s;
      if (sum2[i][j] >= mod) sum2[i][j] -= mod;
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 2; j <= m; j++)
      ans = (ans + (long long)sum1[i][j] *
                       (sum2[n - i][j] - sum1[n - i][j] + 1 + mod) % mod *
                       (m - j + 1)) %
            mod;
  cout << ans << endl;
}
