#include <bits/stdc++.h>
using namespace std;
int n, k;
long long arr[105], dp[100004][105], mod = 1e9 + 7;
bool vis[100004][105];
long long solve(long long curr, int idx) {
  if (curr == 0) return 1;
  if (curr < 0) return 0;
  if (idx == n) return 0;
  if (vis[curr][idx]) return dp[curr][idx];
  vis[curr][idx] = true;
  long long ret = 0;
  for (int i = 0; i <= arr[idx]; i++) {
    if (curr >= i) {
      ret += solve(curr - i, idx + 1);
    } else
      break;
  }
  return dp[curr][idx] = ret % mod;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  cout << solve(k, 0) % mod;
  return 0;
}
