#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int prefix[103][100005];
int a[103], n, k;
inline int sub(int a, int b) {
  int ans = a - b;
  return ans < 0 ? ans + 1000000007 : ans;
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    prefix[i][1] = 1;
  }
  for (int i = 1; i <= k + 1; i++) prefix[0][i] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      int start = max(0, j - a[i]);
      int x = sub(prefix[i - 1][j + 1], prefix[i - 1][start]);
      prefix[i][j + 1] = (prefix[i][j] + x) % 1000000007;
    }
  }
  cout << prefix[n][k + 1] - prefix[n][k] << endl;
}
