#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll N = 1e5 + 5;
const ll mod = 1e9 + 7;
ll n, k;
ll arr[N];
ll solve() {
  ll dp[n + 1][k + 1];
  memset(dp, 0, sizeof(dp));
  for (ll i = 0; i <= n; i++) dp[i][0] = 1;
  for (ll i = 1; i <= n; i++) {
    for (ll j = 1; j <= k; j++) {
      dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
    }
  }
  return dp[n][k] % mod;
}
int main() {
  cin >> n >> k;
  for (ll i = 0; i < n; i++) {
    scanf("%lld", arr + i);
  }
  cout << solve();
  return 0;
}
