#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int inf = 1e9;
const long long INF = 1e18;
const double PI = acos(-1.0);
const double EPS = 1e-8;
const int MOD = 1000000007;
int n, k;
long long int a[N];
long long int dp[105][N];
long long int solve(int idx, int rem) {
  if (idx > n) return rem == 0 ? 1 : 0;
  if (dp[idx][rem] != -1) return dp[idx][rem];
  long long int ret = 0;
  for (int i = 0; i <= a[idx]; i++) {
    if (i <= rem) ret += solve(idx + 1, rem - i);
    ret %= MOD;
  }
  return dp[idx][rem] = ret;
}
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  long long int ans = 0;
  memset(dp, -1, sizeof(dp));
  for (int i = 0; i <= a[1]; i++) {
    ans = (ans % MOD + solve(2, k - i) % MOD) % MOD;
  }
  cout << ans << endl;
  return 0;
}
