#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long K = 1e5 + 5;
long long dp[105][K];
long long n, k;
long long A[105];
long long solve(long long index, long long rem) {
  if (rem == 0) return 1;
  long long ans = 0;
  if (index >= n && rem != 0) return 0;
  for (long long i = 0; i <= A[index]; i++) {
    if (rem - i >= 0) {
      ans = (ans % mod + solve(index + 1, rem - i) % mod) % mod;
    }
  }
  return dp[index][rem] = ans;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  for (long long i = 0; i < n; i++) cin >> A[i];
  long long ans = solve(0, k);
  cout << ans << "\n";
}
