#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int n;
int dp[105][100005];
int arr[105];
long long solve(int idx, int rem) {
  if (rem < 0) return 0;
  if (idx == n) return rem == 0;
  int &ans = dp[idx][rem];
  if (ans != -1) return ans;
  ans = 0;
  if (arr[idx] >= rem)
    return ans = (solve(idx + 1, rem) + solve(idx, rem - 1)) % mod;
  else {
    for (int i = 0; i <= arr[idx]; i++)
      ans = (ans + solve(idx + 1, rem - i)) % mod;
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> arr[i];
  memset(dp, -1, sizeof(dp));
  cout << solve(0, k);
  return 0;
}
