#include <bits/stdc++.h>
using namespace std;
long long dp[101][100001];
void solve(vector<long long> &candies, long long k, long long n) {
  for (int j = 0; j <= k; j++) dp[0][j] = 0;
  for (int i = 0; i <= n; i++) dp[i][0] = 1;
  for (int j = 1; j <= k; j++) {
    if (candies[0] >= j)
      dp[1][j] = 1;
    else
      dp[1][j] = 0;
  }
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      dp[i][j] =
          (dp[i][j - 1] + dp[i - 1][j] -
           ((j - 1 - candies[i - 1]) >= 0 ? dp[i - 1][j - 1 - candies[i - 1]]
                                          : 0)) %
          1000000007;
    }
  }
  cout << dp[n][k] << endl;
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  long long k;
  cin >> k;
  vector<long long> candies(n);
  for (int i = 0; i < n; i++) {
    cin >> candies[i];
  }
  solve(candies, k, n);
  return 0;
}
