#include <bits/stdc++.h>
using namespace std;
const int maxn = 2005, mod = 1000000007;
int n, m, sum, i, j, f[maxn][maxn];
void add(int &x, int y) {
  x += y;
  if (x >= mod) x -= mod;
}
int main() {
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) {
    f[i][2] = 1 + (sum = f[i - 1][2]);
    for (j = 3; j <= m; j++)
      f[i][j] = f[i][j - 1], add(sum, f[i - 1][j]), add(f[i][j], sum);
  }
  sum = 0;
  for (i = 1; i <= n; i++)
    for (j = 2; j <= m; j++) {
      sum = (sum + f[i][j] * (long long)(f[n - i + 1][j] - f[n - i][j]) % mod *
                       (m - j + 1)) %
            mod;
    }
  if (sum < 0) sum += mod;
  printf("%d\n", sum);
  return 0;
}
