#include <bits/stdc++.h>
using namespace std;
long int dp[101][100002];
const int M = 1000000007;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<long long int> a(n);
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<int> pre(k + 1);
  pre[0] = 1;
  long int sum = 0;
  for (long long int i = 0; i < n + 1; i++) {
    if (i != 0) {
      sum += a[i - 1];
      if (sum > k) sum = k;
    }
    for (long long int j = 0; j < k + 1; j++) {
      if (j == 0) {
        dp[i][j] = 1;
      } else if (i == 0 || sum < j) {
        dp[i][j] = 0;
      } else {
        dp[i][j] = pre[j] % M;
        if (j - a[i - 1] - 1 >= 0) {
          dp[i][j] -= ((pre[j - a[i - 1] - 1] + M) % M);
          dp[i][j] %= M;
        }
      }
    }
    for (long long int j = 1; j < k + 1; j++) {
      pre[j] = (pre[j - 1] + dp[i][j]) % M;
    }
  }
  cout << dp[n][k] << "\n";
  return 0;
}
