#include <bits/stdc++.h>
using namespace std;
int n, m, i, j;
int f[2222][2222];
int t[2222][2222];
int *ff, *tt;
int ans, cur;
int main() {
  scanf("%d%d", &n, &m);
  if (m == 1) {
    printf("0\n");
    return 0;
  }
  ff = f[0];
  tt = t[0];
  for (i = 1; i < m; i++) {
    ff[i] = 1;
    tt[i] = 1;
  }
  for (i = 1; i < n; i++) {
    ff = f[i];
    tt = t[i];
    cur = 0;
    ff[0] = 0;
    for (j = 1; j < m; j++) {
      cur = (cur + f[i - 1][j]) % 1000000007;
      ff[j] = (ff[j - 1] + cur) % 1000000007;
      tt[j] = (t[i - 1][j] + ff[j]) % 1000000007;
    }
  }
  ans = 0;
  for (i = 1; i < m; i++) {
    cur = 0;
    for (j = 0; j < n; j++)
      cur = (cur + (int)(1ll * f[j][i] * t[n - j - 1][i] % 1000000007)) %
            1000000007;
    ans = (ans + (int)((m - i | 0ll) * cur % 1000000007)) % 1000000007;
  }
  printf("%d", ans);
  return 0;
}
