#include <bits/stdc++.h>
using namespace std;
long long int a[105], dp[105][100005], n;
long long int mod = 1000000007;
long long int solve(int ind, int count) {
  if (dp[ind][count] != -1) return dp[ind][count];
  if (ind >= n || count < 0) return 0;
  if (count == 0) return 1;
  dp[ind][count] = solve(ind, count - 1) + solve(ind + 1, count) -
                   solve(ind + 1, count - 1 - a[ind]);
  dp[ind][count] = (dp[ind][count] + mod) % mod;
  return dp[ind][count];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int k;
  cin >> n >> k;
  memset(dp, -1, sizeof(dp));
  for (int i = 0; i < n; i++) cin >> a[i];
  cout << solve(0, k) << "\n";
  return 0;
}
