#include <bits/stdc++.h>
using namespace std;
int n, k;
long long pre[100100], cur[100100];
int main() {
  cin >> n >> k;
  int u;
  cin >> u;
  for (int i = 0; i <= u; i++) pre[i] = 1ll;
  int sum = u;
  for (int i = 1; i < n; i++) {
    int x;
    cin >> x;
    sum += x;
    for (int K = 0; K <= k; K++) {
      if (K == 0)
        cur[K] = 1ll;
      else {
        if (K > sum)
          cur[K] = 0ll;
        else if (K > x)
          cur[K] = ((long long)cur[K - 1] + pre[K] - cur[K - x - 1] +
                    (long long)1000000007) %
                   1000000007;
        else
          cur[K] = ((long long)cur[K - 1] + pre[K]) % 1000000007;
      }
    }
    for (int j = 0; j <= k; j++) pre[j] = cur[j];
  }
  cout << pre[k] << endl;
  return 0;
}
