#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, 0, -1, 0, -1, -1, 1, 1};
int dy[] = {0, 1, 0, -1, -1, 1, -1, 1};
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
const int mxN = 3e5 + 5, oo = 0x3f3f3f3f, mod = 1e9 + 7;
int n, k, arr[105];
long long dp[105][mxN];
long long go(int idx, int rem) {
  if (idx == n) return rem == 0;
  if (rem < 0) return 0;
  long long &ret = dp[idx][rem];
  if (~ret) return ret;
  ret = 0;
  ret = go(idx, rem - 1) + go(idx + 1, rem) - go(idx + 1, rem - arr[idx] - 1);
  return ret %= mod;
}
void solve() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> arr[i];
  memset(dp, -1, sizeof dp);
  cout << go(0, k) << "\n";
}
int main() {
  fast();
  solve();
}
