#include <bits/stdc++.h>
const long long inf = 1e15;
const long long size = 100005;
const long long mod = 1e9 + 7;
long long dp[size][101], a[size], n, k;
long long add(long long x, long long y) {
  if (x + y >= mod)
    return x + y - mod;
  else
    return x + y;
}
long long cnt = 0;
long long fun(long long sum, long long ind) {
  if (ind == n) return (sum == 0);
  long long &ans = dp[sum][ind];
  if (ans != -1) return ans;
  ans = 0;
  for (long long i = 0; i <= std::min(a[ind], sum); i++) {
    ans = add(ans, fun(sum - i, ind + 1));
  }
  return ans;
}
int32_t main() {
  memset(dp, -1, sizeof(dp));
  scanf("%lld %lld", &n, &k);
  for (long long i = 0; i < n; i++) scanf("%lld", &a[i]);
  printf("%lld", fun(k, 0));
  return 0;
}
