#include <bits/stdc++.h>
using namespace std;
long long dp[101][100001];
long long topDown(vector<long long> &arr, long long index, long long k) {
  if (k == 0) return 1;
  if (index < 0) return 0;
  if (dp[index][k] > 0) return dp[index][k];
  long long ways = 0;
  for (long long i = min(arr[index], k); i >= 0; i--) {
    if (k - i >= 0) ways += topDown(arr, index - 1, k - i);
    ways %= 1000000007;
  }
  dp[index][k] = ways;
  return ways;
}
void solve() {
  long long n, k;
  cin >> n >> k;
  vector<long long> arr(n);
  for (auto &i : arr) cin >> i;
  memset(dp, 0, sizeof(dp));
  long long ans = topDown(arr, n - 1, k);
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
