#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
inline void Add(int &a, int b) { a = a + b >= mod ? a + b - mod : a + b; }
int n, m, f[2100][2100];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) f[1][i] = 1;
  for (int i = 2; i <= n; i++) {
    f[i][1] = 1;
    int sum = 0;
    for (int j = 2; j <= m; j++)
      Add(sum, f[i - 1][j]), f[i][j] = (f[i][j - 1] + sum) % mod;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 2; j <= m; j++)
      Add(ans, 1ll * (f[i][j] - f[i - 1][j] + mod) % mod * f[n - i + 1][j] %
                   mod * (m - j + 1) % mod);
  printf("%d", ans);
  return 0;
}
