#include <bits/stdc++.h>
using namespace std;
long long n, k;
vector<long long> a;
long long dp[105][100005];
long long candies(long long i, long long k) {
  if (k == 0) return 1;
  if (i == n) return 0;
  if (dp[i][k] != -1) return dp[i][k];
  long long ans = 0;
  for (long long j = 0; j <= min(k, a[i]); j++)
    ans += candies(i + 1, k - j) % 1000000007, ans %= 1000000007;
  return dp[i][k] = ans;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin.tie(nullptr);
  long long t_c = 1;
  while (t_c--) {
    memset(dp, -1, sizeof(dp));
    cin >> n >> k;
    a.resize(n);
    for (long long &i : a) cin >> i;
    cout << candies(0, k) << endl;
  }
}
