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