#include <bits/stdc++.h>
const int N = 2005, mo = (int)1e9 + 7;
int n, m, ans, f[N][N];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    int s = 0;
    f[i][1] = 1;
    for (int j = 2; j <= m; j++)
      f[i][j] = (f[i][j - 1] + (s = (s + f[i - 1][j]) % mo)) % mo;
  }
  for (int i = 1; i <= n; i++)
    for (int j = 2; j <= m; j++)
      ans = (ans + (m - j + 1LL) * (f[i][j] - f[i - 1][j] + mo) % mo *
                       f[n - i + 1][j]) %
            mo;
  printf("%d\n", ans);
}
