#include <bits/stdc++.h>
using namespace std;
const long long INF = 1 << 30;
typedef struct {
  long long x, y;
} point;
priority_queue<pair<double, double>, vector<pair<double, double> >,
               greater<pair<double, double> > >
    pq;
vector<pair<double, pair<double, double> > > vpp;
vector<pair<double, double> > vp;
long long ara[105];
int n, k;
long long dp[105][100006];
long long cal(int pos, long long wait) {
  if (wait > k) {
    return 0;
  }
  if (pos > n) return wait == k;
  if (dp[pos][wait] != -1) {
    return dp[pos][wait];
  }
  long long ret = 0;
  for (long long i = 0; i <= ara[pos]; i++) {
    ret = ret % 1000000007 + cal(pos + 1, wait + i) % 1000000007;
  }
  return dp[pos][wait] = ret;
}
int main() {
  memset(dp, -1, sizeof dp);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> ara[i];
  }
  cout << cal(1, 0);
  return 0;
}
