#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
long long const N = 1e6 + 10;
const long long M = 510;
long long const MOD = 1e9 + 7;
long long a[110];
int32_t main() {
  long long n, k;
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  vector<long long> dp(k + 5, 1LL);
  for (long long i = 1; i <= n; i++) {
    vector<long long> temp(k + 5, 0LL);
    for (long long j = 0; j <= a[i]; j++) {
      temp[j] = dp[j];
    }
    if (i == n) {
      for (long long p = 1; p <= k; p++) {
        if (temp[p] == 0LL)
          continue;
        else
          dp[p] = temp[p];
      }
      break;
    }
    for (long long j = 1; j <= k; j++) {
      temp[j] = temp[j] + temp[j - 1];
      temp[j] %= MOD;
    }
    dp = temp;
  }
  cout << dp[k] << endl;
}
