#include <bits/stdc++.h>
using namespace std;
long long n, k;
vector<long long> a;
vector<vector<long long>> dp;
void aksayushx() {
  cin >> n >> k;
  a.resize(n);
  dp.assign(n, vector<long long>(k + 1, 0));
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i <= a[0]; i++) {
    if (i <= k) dp[0][i] = 1;
  }
  for (long long i = 1; i < n; i++) {
    dp[i][0] = 1;
    for (long long j = 1; j <= k; j++) {
      for (long long x = 0; x <= a[i]; x++) {
        if (j - x >= 0) {
          dp[i][j] += dp[i - 1][j - x];
          dp[i][j] %= 1000000007;
        } else
          break;
      }
    }
  }
  cout << dp[n - 1][k];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int test = 1;
  while (test--) aksayushx();
  return 0;
}
