#include <bits/stdc++.h>
using namespace std;
const long long p = 1000000007;
int n, m;
long long a[2010][2010], ans;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) a[1][i] = 1;
  for (int i = 2; i <= n; i++) {
    a[i][1] = 1;
    long long sum = 0;
    for (int j = 2; j <= m; j++) {
      sum = (sum + a[i - 1][j]) % p;
      a[i][j] = (a[i][j - 1] + sum) % p;
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 2; j <= m; j++)
      ans = (ans + (a[i][j] - a[i - 1][j] + p) % p * a[n - i + 1][j] % p *
                       (m - j + 1) % p) %
            p;
  printf("%lld", ans);
  return 0;
}
