#include <bits/stdc++.h>
using namespace std;
const long long md = 1000000007;
long long ans, f[2002][2002];
int n, m;
inline void solve() {
  scanf("%d%d", &n, &m);
  for (register int i = 1; i <= m; ++i) f[1][i] = 1;
  for (register int i = 2; i <= n; ++i) {
    int t = 0;
    f[i][1] = 1;
    for (register int j = 2; j <= m; ++j) {
      (t += f[i - 1][j]) %= md;
      f[i][j] = (f[i][j - 1] + t) % md;
    }
  }
  for (register int i = 1; i <= n; ++i)
    for (register int j = 2; j <= m; ++j)
      (ans += (m - j + 1) * (f[i][j] - f[i - 1][j] + md) % md *
              f[n - i + 1][j] % md) %= md;
  printf("%lld\n", ans);
}
int main() {
  ios_base::sync_with_stdio(false);
  int T = 1;
  for (; T--;) solve();
}
