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