#include <bits/stdc++.h>
using namespace std;
const long long MOD = (long long)1e9 + 7;
int n, k, a[105];
long long dp[105][100005];
long long solve(int ind, int rem) {
  if (rem < 0) return 0;
  if (ind == n + 1) {
    return rem == 0;
  }
  if (rem == 0) {
    return dp[ind][rem] = 1;
  }
  if (dp[ind][rem] != -1) {
    return dp[ind][rem];
  }
  long long ans = 0;
  for (int i = 0; i <= a[ind]; i++) {
    ans += solve(ind + 1, rem - i);
    ans %= MOD;
  }
  return dp[ind][rem] = ans % MOD;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
  }
  memset(dp, -1LL, sizeof dp);
  printf("%lld\n", solve(1, k));
  return 0;
}
