#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << " ";
  err(++it, args...);
}
inline void normal(long long &a) {
  a %= 1000000007;
  (a < 0) && (a += 1000000007);
}
inline long long modMul(long long a, long long b) {
  a %= 1000000007, b %= 1000000007;
  normal(a), normal(b);
  return (a * b) % 1000000007;
}
inline long long modAdd(long long a, long long b) {
  a %= 1000000007, b %= 1000000007;
  normal(a), normal(b);
  return (a + b) % 1000000007;
}
inline long long modSub(long long a, long long b) {
  a %= 1000000007, b %= 1000000007;
  normal(a), normal(b);
  a -= b;
  normal(a);
  return a;
}
inline long long modPow(long long b, long long p) {
  long long r = 1;
  while (p) {
    if (p & 1LL) r = modMul(r, b);
    b = modMul(b, b);
    p >>= 1LL;
  }
  return r;
}
inline long long modInverse(long long a) { return modPow(a, 1000000007 - 2); }
inline long long modDiv(long long a, long long b) {
  return modMul(a, modInverse(b));
}
long long n, k;
long long ara[100005];
long long dp[105][100005];
int c = 0;
void solve(long long i, long long baki) {
  c++;
  if (i == n - 1) {
    if (ara[i] >= baki)
      dp[i][baki] = 1;
    else
      dp[i][baki] = 0;
    return;
  }
  long long &res = dp[i][baki];
  if (res != -1) return;
  res = 0;
  for (long long j = 0; j <= ara[i] && j <= baki; j++) {
    if (dp[i + 1][baki - j] == -1) solve(i + 1, baki - j);
    res = (res + dp[i + 1][baki - j]) % 1000000007;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> ara[i];
  }
  memset(dp, -1, sizeof(dp));
  solve(0, k);
  cout << dp[0][k] << endl;
}
