#include <bits/stdc++.h>
using namespace std;
long long n;
long long a[101];
vector<vector<long long>> dp(101, vector<long long>(100005, -1));
long long candies(long long ind, long long left) {
  if (left == 0) return 1;
  if (ind == 0 || left < 0) return 0;
  long long &ans = dp[ind][left];
  if (ans != -1) return ans;
  ans = candies(ind, left - 1);
  ans = (ans + candies(ind - 1, left)) % 1000000007;
  ans =
      (ans - candies(ind - 1, left - a[ind - 1] - 1) + 1000000007) % 1000000007;
  return ans;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long k;
  cin >> n >> k;
  a[0] = 0;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  cout << candies(n, k);
  return 0;
}
