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