#include <bits/stdc++.h>
using namespace std;
long long int Mod = 1e9 + 7;
long long dp[103][100005];
int main() {
  long n, k, i, j, ans = 0;
  cin >> n >> k;
  long A[n + 1];
  A[0] = -1;
  for (i = 1; i <= n; i++) cin >> A[i];
  for (i = 0; i <= A[1]; i++) dp[1][i] = 1;
  for (i = A[1] + 1; i <= k; i++) dp[1][i] = 0;
  for (i = 1; i <= n; i++) dp[i][0] = 1;
  for (i = 2; i <= n; i++) {
    for (j = 1; j <= k; j++) dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % Mod;
  }
  cout << dp[n][k] << endl;
}
