#include <bits/stdc++.h>
using namespace std;
inline long long add(long long a, long long b) {
  a += b;
  if (a >= 1000000007) a -= 1000000007;
  return a;
}
inline long long sub(long long a, long long b) {
  a -= b;
  if (a < 0) a += 1000000007;
  return a;
}
inline long long mul(long long a, long long b) {
  return (long long)((long long)a * b % 1000000007);
}
long long min(long long a, long long b) { return a > b ? b : a; }
long long max(long long a, long long b) { return a > b ? a : b; }
long long n, k;
long long ar[200];
long long postf[200];
long long cnt = 0;
long long arr[100005][102];
long long pre[100005][102];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i += 1) {
    for (int j = 0; j < k + 1; j += 1) {
      arr[i][j] = -1;
    }
  }
  long long sum = 0;
  for (int i = 0; i < n; i += 1) {
    cin >> ar[i];
  }
  for (int i = n - 1; i >= 0; i--) {
    sum += ar[i];
    postf[i] = sum;
  }
  if (k > postf[0]) {
    cout << 0 << "\n";
    return 0;
  }
  for (int i = 0; i < k + 1; i += 1) {
    if (i <= ar[n - 1]) {
      arr[i][n - 1] = 1;
    } else {
      arr[i][n - 1] = 0;
    }
  }
  sum = arr[0][n - 1];
  pre[0][n - 1] = arr[0][n - 1];
  for (int i = 1; i < k + 1; i += 1) {
    sum = (sum + arr[i][n - 1]) % 1000000007;
    pre[i][n - 1] = sum;
  }
  for (int i = n - 2; i >= 0; i--) {
    long long sum = 0;
    for (int j = 0; j <= k; j++) {
      if (j >= ar[i])
        arr[j][i] = pre[j][i + 1] - pre[j - ar[i] - 1][i + 1];
      else {
        arr[j][i] = pre[j][i + 1];
      }
      sum = add(sum, arr[j][i]);
      pre[j][i] = sum;
    }
  }
  cout << arr[k][0] << "\n";
}
