#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)1e9 + 7;
long long n, k;
vector<long long> a;
long long dp[110][100010];
long long Rec(long long pos, long long ost) {
  if (pos == n) {
    return 1;
  }
  if (ost == 0) {
    return 1;
  }
  if (dp[pos][ost] != -1) {
    return dp[pos][ost];
  }
  long long ret = 0;
  for (long long i = 0; i <= min(ost, a[pos]); i++) {
    if (pos == n - 1 && ost > i) continue;
    ret = (ret + Rec(pos + 1, ost - i)) % mod;
  }
  return dp[pos][ost] = ret;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  for (long long i = 0; i < 110; i++) {
    for (long long j = 0; j < 100010; j++) {
      dp[i][j] = -1;
    }
  }
  cin >> n >> k;
  a.resize(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  cout << Rec(0, k);
  return 14 / 88;
}
