#include <bits/stdc++.h>
using namespace std;
const int M = 2005, P = (int)1e9 + 7;
void Add(int &x, int y) {
  x += y;
  if (x >= P) x -= P;
}
int n, m;
int dp[M][M], pd[M][M];
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; i++) dp[1][i] = 1;
  for (int i = 2, sum, p = 1; i <= n; i++, p++) {
    sum = 0;
    for (int j = 2; j <= m; j++) {
      Add(sum, dp[p][j]);
      Add(dp[i][j], sum);
      Add(dp[i][j], dp[i][j - 1]);
    }
  }
  for (int i = 1, p = 0; i <= n; i++, p++)
    for (int j = 2; j <= m; j++) Add(pd[i][j] = pd[p][j], dp[i][j]);
  int ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 2; j <= m; j++)
      Add(ans, (long long)dp[i][j] * pd[n - i + 1][j] % P * (m - j + 1) % P);
  printf("%d\n", ans);
  return 0;
}
