#include <bits/stdc++.h>
using namespace std;
vector<int> a;
vector<vector<long long> > dp(105, vector<long long>(100005, -1));
long long q(int i, int k) {
  if (k == 0)
    return 1;
  else if (k < 0 || i < 0)
    return 0;
  else if (dp[i][k] != -1)
    return dp[i][k];
  dp[i][k] = q(i - 1, k) % 1000000007 + q(i, k - 1) % 1000000007 -
             q(i - 1, k - a[i] - 1) % 1000000007;
  return dp[i][k];
}
int main() {
  int N, K;
  cin >> N >> K;
  a.resize(N);
  for (int i = 0; i < (N); ++i) cin >> a[i];
  cout << q(N - 1, K) << endl;
  return 0;
}
