#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[105], dp[105][100005] = {0};
int MEM(int ind, int left) {
  if (ind == 0) return 0;
  if (left == 0) return 1;
  int &ans = dp[ind][left];
  if (ans != -1) return ans;
  ans = MEM(ind, left - 1);
  ans = (ans + MEM(ind - 1, left)) % (int)(1e9 + 7);
  if (left - a[ind - 1] - 1 >= 0)
    ans = (ans - MEM(ind - 1, left - a[ind - 1] - 1) + (int)(1e9 + 7)) %
          (int)(1e9 + 7);
  return ans;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  memset(dp, -1, sizeof dp);
  cout << MEM(n, k);
  return 0;
}
