#include <bits/stdc++.h>
using namespace std;
char buf[1 << 21], *p1 = buf, *p2 = buf;
template <class T>
void read(T &x) {
  x = 0;
  int c = getchar();
  int flag = 0;
  while (c < '0' || c > '9') flag |= (c == '-'), c = getchar();
  while (c >= '0' && c <= '9')
    x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  if (flag) x = -x;
}
template <class T>
T _max(T a, T b) {
  return b < a ? a : b;
}
template <class T>
T _min(T a, T b) {
  return a < b ? a : b;
}
template <class T>
bool checkmax(T &a, T b) {
  return a < b ? a = b, 1 : 0;
}
template <class T>
bool checkmin(T &a, T b) {
  return b < a ? a = b, 1 : 0;
}
const int mod = 1000000000 + 7;
void add(int &a, int b) {
  a += b;
  (a >= mod) && (a -= mod);
}
void sub(int &a, int b) {
  a -= b;
  (a < 0) && (a += mod);
}
void mul(int &a, int b) { a = (long long)a * b % mod; }
int Add(int a, int b) {
  a += b;
  return a >= mod ? a - mod : a;
}
int Sub(int a, int b) {
  a -= b;
  return a < 0 ? a + mod : a;
}
int Mul(int a, int b) { return (long long)a * b % mod; }
int qpow(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = (long long)ans * a % mod;
    a = (long long)a * a % mod;
    b >>= 1;
  }
  return ans;
}
int Mul(int a, int b, int c) { return Mul(a, Mul(b, c)); }
int n, m;
int f[2005][2005];
int sum[2005][2005], sum2[2005][2005];
void init() {
  read(n);
  read(m);
  for (int i = 2; i <= m; ++i) {
    f[1][i] = 1;
    sum[1][i] = Add(sum[1][i - 1], f[1][i]);
    sum2[1][i] = Add(sum2[1][i - 1], Mul(f[1][i], i));
  }
  for (int i = 2; i <= n; ++i) {
    for (int j = 2; j <= m; ++j) {
      f[i][j] = 1;
      add(f[i][j], Mul(sum[i - 1][j], j + 1));
      sub(f[i][j], sum2[i - 1][j]);
      sum[i][j] = Add(sum[i][j - 1], f[i][j]);
      sum2[i][j] = Add(sum2[i][j - 1], Mul(f[i][j], j));
    }
  }
}
void solve() {
  int ans = 0;
  for (int k = 2; k <= m; ++k) {
    for (int i = 1; i <= n; ++i) {
      add(ans, Mul(m - k + 1, Sub(f[i][k], f[i - 1][k]), f[n - i + 1][k]));
    }
  }
  printf("%d\n", ans);
}
int main() {
  init();
  solve();
  return 0;
}
