#include <bits/stdc++.h>
using namespace std;
long long s1[2100][2100], sum[2100][2100], cnt[2100][2100], cnt1[2100][2100];
int main() {
  int n, m, i, j;
  long long res;
  scanf("%d%d", &n, &m);
  for (i = 2; i <= m; i++) {
    for (j = 1; j <= n; j++) {
      cnt[i][j] = sum[i][j - 1] + 1;
      cnt[i][j] %= 1000000007;
      s1[i][j] = s1[i - 1][j] + cnt[i][j];
      s1[i][j] %= 1000000007;
      sum[i][j] = sum[i - 1][j] + s1[i][j];
      sum[i][j] %= 1000000007;
      cnt1[i][j] = cnt[i][j] - cnt[i][j - 1];
      if (cnt1[i][j] < 0) cnt1[i][j] += 1000000007;
    }
  }
  res = 0;
  for (i = 2; i <= m; i++)
    for (j = 1; j <= n; j++) {
      res += ((cnt[i][j] * cnt1[i][n - j + 1]) % 1000000007) * (m - i + 1);
      res %= 1000000007;
    }
  printf("%I64d\n", res);
  return 0;
}
