#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x, long long int y, long long int p) {
  long long int r = 1;
  x = x % p;
  while (y) {
    if (y & 1) r = r * x % p;
    y = y >> 1;
    x = x * x % p;
  }
  return r;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int csrand(int l = 0, int r = 1e9) {
  uniform_int_distribution<int> uid(l, r);
  return uid(rng);
}
const int N = 1e5 + 99;
int n, k;
long long int a[N], dp[N][105];
long long int solve(int i, long long int rem) {
  if (rem < 0) return 0;
  if (i == n + 1) return rem == 0;
  if (dp[rem][i] != -1) return dp[rem][i];
  long long int ans = 0;
  for (long long int j = 0; j <= min(rem, a[i]); j++)
    ans = (ans + solve(i + 1, rem - j)) % 1000000007;
  return dp[rem][i] = ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  memset(dp, -1, sizeof(dp));
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  long long int ans = solve(1, k);
  cout << ans << '\n';
}
