#include <bits/stdc++.h>
using namespace std;
long long f[2010][2010], n, s, ans, m;
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    s = 0;
    for (int j = 0; j <= m - 2; ++j)
      s = (s + f[i - 1][j]) % 1000000007,
      f[i][j] = ((j == 0 ? 1 : f[i][j - 1]) + s) % 1000000007;
  }
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j <= m - 2; ++j)
      ans = (ans + (m - j - 1) * (f[i][j] - f[i - 1][j]) % 1000000007 *
                       f[n - i + 1][j] % 1000000007) %
            1000000007;
  cout << (ans + 1000000007) % 1000000007;
}
