#include <bits/stdc++.h>
using namespace std;
const long long int N = 101;
const long long int K = 1e5 + 2;
const long long int mod = 1e9 + 7;
long long int add(long long int a, long long int b) {
  return ((a % mod) + (b % mod)) % mod;
}
long long int dp[N][K];
long long int a[N];
long long int n, k;
long long int solve(long long int idx, long long int rem) {
  if (idx == n + 1) {
    if (rem == 0) return 1;
    return 0;
  }
  if (rem < 0) return 0;
  if (rem == 0) return 1;
  if (dp[idx][rem] != -1) return dp[idx][rem];
  long long int ans = 0;
  for (long long int i = 0; i <= a[idx]; i++) {
    ans = add(ans, solve(idx + 1, rem - i));
  }
  dp[idx][rem] = ans;
  return ans;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> k;
  for (long long int i = 1; i <= n; i++) cin >> a[i];
  memset(dp, -1, sizeof(dp));
  cout << solve(1, k);
}
