#include <bits/stdc++.h>
using namespace std;
int i, j, k, l, n, m, f[2100][2100], g[2100][2100], ans, t;
int main() {
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; ++i) {
    for (t = 0, j = 2; j <= m; ++j)
      t = (t + f[i - 1][j]) % 1000000007,
      f[i][j] = (f[i][j - 1] + t) % 1000000007;
    for (j = 2; j <= m; ++j) f[i][j]++;
  }
  for (i = 1; i <= n; ++i)
    for (t = 0, j = 2; j <= m; ++j)
      t = (t + f[i][j]) % 1000000007, g[i][j] = (g[i][j - 1] + t) % 1000000007;
  for (i = 1; i <= n; ++i)
    for (j = 2; j <= m; ++j)
      ans = ((long long)f[i][j] * (1 + g[n - i][j] - f[n - i][j]) % 1000000007 *
                 (m - j + 1) +
             ans) %
            1000000007;
  printf("%d\n", (ans + 1000000007) % 1000000007);
}
