#include <bits/stdc++.h>
using namespace std;
long long int dp[105][100005];
int main() {
  long long int n, k, l = 1000000007;
  cin >> n >> k;
  long long int a[n], i, j;
  for (i = 0; i < n; ++i) cin >> a[i];
  for (j = 0; j <= a[0]; ++j) dp[0][j] = 1;
  for (i = 1; i < n; ++i) {
    for (j = 0; j <= a[i]; ++j) dp[i][j] = dp[i - 1][j];
    for (j = 1; j <= a[i]; ++j) dp[i][j] = (dp[i][j] + dp[i][j - 1]) % l;
  }
  if (n != 1)
    for (i = 0; i <= k; ++i)
      if (dp[n - 1][i] == 0) dp[n - 1][i] = dp[n - 1][i - 1];
  cout << dp[n - 1][k];
  return 0;
}
