#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const int maxn = 2000 + 100;
long long dp[maxn][maxn];
long long sum[maxn][maxn];
int main() {
  int n, m;
  cin >> n >> m;
  for (int j = 1; j <= m; j++) dp[1][j] = j * (j - 1) / 2;
  for (int i = 2; i <= n; i++)
    for (int j = 1; j <= m; j++)
      dp[i][j] = (dp[i - 1][j] + dp[i][j - 1] * 2 - dp[i][j - 2]) % mod;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) sum[i][j] = (sum[i - 1][j] + dp[i][j]) % mod;
  long long ans = 0;
  for (int t = 1; t <= n; t++)
    for (int j = 2; j <= m; j++)
      ans = (ans + ((m - j + 1) % mod *
                    ((sum[t - 1][j] + 1) *
                     (1 + sum[n - t][j - 1] * 2 - sum[n - t][j - 2]) % mod) %
                    mod) %
                       mod) %
            mod;
  cout << (ans + mod) % mod << endl;
}
