#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int N = 2010;
int n, m, f[N][N], ans;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1, t, s; i <= n; i++) {
    t = 0, s = 1;
    for (int j = 2; j <= m; j++)
      t = (t + f[i - 1][j]) % MOD, f[i][j] = s = (s + t) % MOD;
  }
  for (int i = 1; i <= n; i++)
    for (int j = 2; j <= m; j++)
      ans = (ans + 1ll * (m - j + 1) * (f[i][j] - f[i - 1][j]) % MOD *
                       f[n - i + 1][j]) %
            MOD;
  printf("%d\n", (ans + MOD) % MOD);
  return 0;
}
