#include <bits/stdc++.h>
const int mod = 1000000007;
long long f[2005][2005], g[2005][2005];
int main() {
  for (int n, m; scanf("%d%d", &n, &m) != EOF;) {
    memset(f, 0, sizeof(f));
    memset(g, 0, sizeof(g));
    for (int i = 1; i <= n; i++) {
      long long sum = 0;
      for (int j = 2; j <= m; j++) {
        f[i][j] = (g[i - 1][j] + 1) % mod;
        sum = (sum + f[i][j]) % mod;
        g[i][j] = (g[i][j - 1] + sum) % mod;
      }
    }
    long long ans = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = 2; j <= m; j++) {
        ans = ans + (f[i][j] * (g[n - i][j] - f[n - i][j] + 1) % mod) *
                        (m - j + 1) % mod;
        ans = ans % mod;
      }
    }
    printf("%I64d\n", ans);
  }
}
