#include <bits/stdc++.h>
using namespace std;
const int Mod = 1e9 + 7;
int n, m, f[2010][2010], s, t;
long long ans;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    s = 1;
    t = 0;
    for (int j = 2; j <= m; j++) {
      t = (t + f[i - 1][j]) % Mod;
      s = (s + t) % Mod;
      f[i][j] = s;
    }
  }
  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) % Mod *
                       f[n - i + 1][j]) %
            Mod;
      if (ans < 0) {
        cout << j << " " << f[i][j] - f[i - 1][j] << " " << f[n - i + 1][j]
             << endl;
        system("pause");
      }
    }
  }
  cout << ans << endl;
  return 0;
}
