#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;
const long long N = 1e5 + 1, M = 1e9 + 7;
long long n, k;
long long dp[101][N];
bool C[101][N];
long long a[101];
long long rec(long long cur, long long sandy) {
  if (cur == n) return (sandy == 0);
  if (C[cur][sandy]) return dp[cur][sandy];
  long long ans = 0;
  for (int i = 0; i <= a[cur]; i++) {
    ans += rec(cur + 1, sandy - i);
    ans %= M;
  }
  dp[cur][sandy] = ans;
  C[cur][sandy] = 1;
  return ans % M;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  cout << rec(0, k);
}
