#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int NMAX = 1e2 + 11;
const int KMAX = 1e5 + 11;
const int MOD = 1e9 + 7;
int n, k, a[NMAX];
ll mem[NMAX][KMAX];
bool vis[NMAX][KMAX];
int dp(int i, int s) {
  ll &ans = mem[i][s];
  if (vis[i][s]) return ans;
  vis[i][s] = true;
  if (i == n - 1) {
    if (s <= a[i])
      return (ans = 1);
    else
      return (ans = 0);
  }
  for (int d = 0; d <= a[i]; ++d) {
    if (d > s) break;
    ans = (ans + dp(i + 1, s - d)) % MOD;
  }
  return ans;
}
int main(void) {
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> a[i];
  cout << dp(0, k) << endl;
  return 0;
}
