#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
int n, m;
long long ans, f[2002][2002];
int main() {
  scanf("%d%d", &n, &m);
  memset(f, 0, sizeof(f));
  for (int i = 1; i <= n; i++) {
    long long t = f[i - 1][2];
    f[i][2] = t + 1;
    for (int j = 3; j <= m; j++) {
      t = (t + f[i - 1][j]) % mod;
      f[i][j] = (t + f[i][j - 1]) % mod;
    }
  }
  ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 2; j <= m; j++)
      ans = (ans +
             (f[i][j] * (f[n - i + 1][j] - f[n - i][j]) % mod) * (m - j + 1)) %
            mod;
  printf("%I64d\n", ans);
  return 0;
}
