#include <bits/stdc++.h>
using namespace std;
long long dp[2010][2010];
long long sum[2010][2010][2];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int j = 2; j <= m; j++) {
    dp[1][j] = 1;
    sum[1][j][0] = j - 1;
    sum[1][j][1] = sum[1][j - 1][1] + j;
  }
  for (int i = 2; i <= n; i++) {
    for (int j = 2; j <= m; j++) {
      dp[i][j] = sum[i - 1][j][0] * (j + 1) - sum[i - 1][j][1];
      dp[i][j] = dp[i][j] % 1000000007;
      if (dp[i][j] < 0) dp[i][j] += 1000000007;
      sum[i][j][0] = (sum[i][j - 1][0] + dp[i][j]) % 1000000007;
      sum[i][j][1] = (sum[i][j - 1][1] + dp[i][j] * j) % 1000000007;
      dp[i][j] = dp[i][j] + dp[i - 1][j];
      if (dp[i][j] >= 1000000007) dp[i][j] -= 1000000007;
    }
  }
  long long tot = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 2; j <= m; j++) {
      tot += dp[i][j] * dp[n - i + 1][j] % 1000000007 * (m - j + 1);
      tot -= dp[i][j] * dp[n - i][j] % 1000000007 * (m - j + 1);
      tot %= 1000000007;
    }
  tot = (tot % 1000000007 + 1000000007) % 1000000007;
  printf("%d\n", tot);
}
