#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long n, m, f[2005][2005], ans;
int main() {
  scanf("%lld%lld", &n, &m);
  for (long long i = 1; i <= n; ++i) {
    long long sum = 0;
    for (long long j = 2; j <= m; ++j)
      sum = (sum + f[i - 1][j]) % mod, f[i][j] = (f[i][j - 1] + sum) % mod;
    for (long long j = 2; j <= m; ++j) f[i][j]++;
  }
  for (long long i = 1; i <= n; ++i)
    for (long long j = 2; j <= m; ++j)
      ans = (ans + f[i][j] * (f[n - i + 1][j] - f[n - i][j] + mod) % mod *
                       (m - j + 1) % mod) %
            mod;
  printf("%lld", ans);
  return 0;
}
