#include <bits/stdc++.h>
using namespace std;
const int N = 1e2 + 4, M = 200005, MOD = 1e9 + 7;
int n, k;
int arr[M], cache[N][M];
int dp(int pos, int val) {
  if (val > k) return 0;
  if (pos == n) return val == k;
  int &ans = cache[pos][val];
  if (ans != -1) return ans;
  ans = dp(pos, val + 1) + dp(pos + 1, val) - dp(pos + 1, val + arr[pos] + 1) +
        2 * MOD;
  ans %= MOD;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  memset(cache, -1, sizeof cache);
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  cout << dp(0, 0) % MOD;
  return 0;
}
