#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)1e9 + 7;
long long n, k;
vector<long long> arr;
long long memo[101][100001];
long long func(int i, int kk) {
  if (i == n - 1 && kk > arr[i]) return 0;
  if (i == n - 1 || kk == 0) return 1;
  if (memo[i][kk] != -1) return memo[i][kk];
  long long cnt = 0;
  for (long long j = 0; j <= arr[i]; j++) {
    if (j <= kk) cnt += func(i + 1, kk - j);
    cnt = cnt % mod;
  }
  return memo[i][kk] = cnt;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.setf(ios::fixed), cout.precision(20);
  cin >> n >> k;
  arr.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (int i = 0; i < 101; i++)
    for (int j = 0; j < 100001; j++) {
      memo[i][j] = -1;
    }
  long long xx = func(0, k);
  cout << xx << "\n";
  return 0;
}
