#include <bits/stdc++.h>
using namespace std;
const int MN = 2005, inf = 1000000005, mod = 1000000007;
const long long INF = 1000000000000000005LL;
long long dp[MN][MN], pref[MN][MN];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  if (m < 2) {
    printf("0");
    return 0;
  }
  for (int k = 1; k <= n; ++k) {
    long long suma = 0LL, wsuma = 0LL;
    for (int l = 2; l <= m; ++l) {
      suma += dp[k - 1][l];
      suma %= mod;
      wsuma += suma;
      wsuma %= mod;
      dp[k][l] = (wsuma + 1LL + mod) % mod;
    }
  }
  for (int k = n; k > 1; --k)
    for (int l = 2; l <= m; ++l)
      dp[k][l] = (dp[k][l] - dp[k - 1][l] + mod) % mod;
  long long ans = 0LL;
  for (int i = 1; i <= n; ++i)
    for (int l = 2; l <= m; ++l) pref[i][l] = (pref[i - 1][l] + dp[i][l]) % mod;
  for (int i = 1; i <= n; ++i)
    for (int l = 2; l <= m; ++l) {
      ans +=
          ((((dp[i][l] * pref[n - i + 1][l]) % mod) * 1LL * (m - l + 1)) % mod);
      ans %= mod;
    }
  printf("%lld", ans);
}
