#include <bits/stdc++.h>
using namespace std;
int N;
long int K;
long int a[1000000];
int cache[1000000][120];
long long int mod = pow(10, 9) + 7;
long long int num_discandies(long int K, int i) {
  if (cache[K][i] != -1) return cache[K][i];
  if (i == N - 1) {
    if (K <= a[N - 1]) return 1;
    return 0;
  }
  long int j;
  long long int sum = 0;
  for (j = 0; j <= a[i]; j++) {
    if (K >= j) sum += num_discandies(K - j, i + 1) % mod;
  }
  return cache[K][i] = sum % mod;
}
int main() {
  cin >> N >> K;
  memset(cache, -1, sizeof(cache));
  for (long int i = 0; i < N; i++) cin >> a[i];
  long long int x = num_discandies(K, 0);
  cout << x;
}
