#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e15;
const int MAXM = 1e2 + 4;
const int MAXN = 1e5 + 1;
int arr[MAXM];
long long dp[MAXM][MAXN];
long long solve(int n, int k) {
  if (k == 0) return 1LL;
  if (n == 0) return 0LL;
  if (dp[n][k] != -1) return dp[n][k];
  long long ret = 0LL;
  for (int i = 0; i <= arr[n]; i++) {
    ret += solve(n - 1, k - i);
  }
  if (ret >= 1000000007) ret %= 1000000007;
  return dp[n][k] = ret;
}
int main() {
  memset(dp, -1, sizeof(dp));
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  cout << solve(n, k) << endl;
  return 0;
}
