#include <bits/stdc++.h>
using namespace std;
bool sieve[2000006];
void sieve_make() {
  memset(sieve, true, sizeof(sieve));
  sieve[0] = sieve[1] = false;
  for (long long i = 2; i * i < 2000006; i++) {
    if (sieve[i]) {
      for (long long j = i * i; j < 2000006; j += i) sieve[j] = false;
    }
  }
}
long long max(long long a, long long b) {
  if (a > b) return a;
  return b;
}
long long min(long long a, long long b) {
  if (a < b) return a;
  return b;
}
long long modexp(long long a, long long b, long long c) {
  if (a == 0) return 0;
  if (b == 0) return 1;
  long long ans;
  if (b % 2 == 0) {
    long long small = modexp(a, b / 2, c);
    ans = (small * small) % c;
  } else {
    long long small = modexp(a, b - 1, c);
    ans = (a % c);
    ans = (small * ans) % c;
  }
  return (ans + c) % c;
}
bool sign(long long x) {
  if (x > 0) return true;
  return false;
}
long long kadane(long long* a, long long n) {
  long long loc = a[0], glo = a[0];
  for (long long i = 1; i < n; i++) {
    loc = max(a[i], loc + a[i]);
    glo = max(glo, loc);
  }
  return glo;
}
long long dp[101][100001];
long long solve(vector<long long>& a, long long i, long long k) {
  if (k == 0) return 1;
  if (i == a.size()) 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 = (ans % 1000000007 + solve(a, i + 1, k - j) % 1000000007) % 1000000007;
  }
  return dp[i][k] = ans;
}
int32_t main() {
  ios::sync_with_stdio(NULL);
  cin.tie(NULL);
  cout.tie(NULL);
  memset(dp, -1, sizeof dp);
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  long long s = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  cout << solve(a, 0, k) << '\n';
}
