#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
long long sz, k, MOD = 1000000007LL, arr[105], dp[105][100005];
long long rec(long long v, long long sum) {
  long long ans = 0;
  if (sum > k) {
    return 0LL;
  }
  if (v > sz && sum != k) {
    return 0LL;
  }
  if (v > sz && sum == k) {
    return 1LL;
  }
  if (dp[v][sum] != -1LL) {
    return dp[v][sum] % MOD;
  }
  for (int i = 0; i <= arr[v]; i++) {
    ans = ((ans % MOD) + (rec(v + 1, sum + i) % MOD)) % MOD;
  }
  return dp[v][sum] = ans % MOD;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cout.precision(30);
  cerr.precision(7);
  ;
  memset(dp, -1LL, sizeof dp);
  cin >> sz >> k;
  for (int i = 1; i <= sz; i++) {
    cin >> arr[i];
  }
  cout << rec(1LL, 0LL);
  return 0;
}
