#include <bits/stdc++.h>
using namespace std;
long long powmod(long long base, long long exp, long long MOD) {
  long long res = 1;
  while (exp > 0) {
    if (exp % 2 == 1) res = (res * base) % MOD;
    base = (base * base) % MOD;
    exp /= 2;
  }
  return (res % MOD);
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long dp[105][100005];
long long cal(int n, int k, vector<int> &a) {
  if (n == 1) {
    return k <= a[n - 1];
  }
  if (k < 0) return 0;
  if (dp[n][k] != -1) return dp[n][k] % 1000000007;
  long long ans =
      (cal(n, k - 1, a) + cal(n - 1, k, a) - cal(n - 1, k - 1 - a[n - 1], a)) %
      1000000007;
  return dp[n][k] = ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  memset(dp, -1, sizeof(dp));
  cout << cal(n, k, a) << endl;
}
