#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1, ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline void write(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
}
inline void writeln(long long x) {
  write(x);
  puts("");
}
const long long N = 2005, mod = 1e9 + 7;
long long n, m, dp[N][N], sum, ans;
inline void init() {
  n = read();
  m = read();
}
inline void update(long long &x, long long y) { x = (x + y) % mod; }
inline void solve() {
  for (long long i = 1; i <= m; i++) dp[1][i] = 1;
  for (long long i = 2; i <= n; i++) {
    dp[i][1] = 1;
    sum = 0;
    for (long long j = 2; j <= m; j++) {
      update(sum, dp[i - 1][j]);
      update(dp[i][j], sum + dp[i][j - 1]);
    }
  }
  for (long long i = 1; i <= n; i++) {
    for (long long j = 2; j <= m; j++) {
      update(ans, (dp[i][j] - dp[i - 1][j] + mod) % mod * dp[n - i + 1][j] %
                      mod * (m - j + 1) % mod);
    }
  }
  writeln(ans);
}
signed main() {
  init();
  solve();
  return 0;
}
