#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long power(long long first, long long n) {
  long long result = 1;
  while (n > 0) {
    if (n % 2 == 1) result = (result * first) % 1000000007;
    first = (first * first) % 1000000007;
    n = n / 2;
  }
  return result % 1000000007;
}
long long dp[105][100005] = {0};
vector<long long> candies;
long long candy(long long curr, long long k) {
  if (!k) return 1;
  if (k < 0 || curr < 0) return 0;
  if (dp[curr][k] >= 0) return dp[curr][k];
  long long ans = 0;
  for (long long i = 0; i <= candies[curr] && k - i >= 0; i++) {
    ans = (ans + candy(curr - 1, k - i)) % 1000000007;
  }
  return dp[curr][k] = ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  memset(dp, -1, sizeof(dp));
  long long n, k;
  cin >> n >> k;
  for (long long i = 0; i < n; i++) {
    long long first;
    cin >> first;
    candies.emplace_back(first);
  }
  cout << candy(n - 1, k) << '\n';
}
