#include <bits/stdc++.h>
using namespace std;
long long int n;
long long int v[101];
long long int DP[100001];
int main() {
  {
    long long int k;
    cin >> n >> k;
    for (long long int i = 0; i < n; i++) cin >> v[i];
    memset(DP, 0, sizeof(DP));
    DP[0] = 1;
    for (int i = 0; i < n; i++) {
      vector<int> pref(k + 1, 0);
      for (int j = k; j >= 0; j--) {
        int tmp = DP[j];
        int l = j + 1, r = j + min(k - j, v[i]);
        if (l <= r) {
          pref[l] = (pref[l] + tmp) % 1000000007;
          if (r + 1 <= k) pref[r + 1] = (pref[r + 1] - tmp) % 1000000007;
        }
      }
      long long int sum = 0;
      for (int j = 0; j <= k; j++) {
        sum = (sum + pref[j]) % 1000000007;
        DP[j] = (DP[j] + sum) % 1000000007;
      }
    }
    cout << DP[k];
  }
  return 0;
}
