#include <bits/stdc++.h>
using namespace std;
void print() { cout << "\n"; }
template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " ";
  print(args...);
}
long long llipowerp(long long x, long long y, long long p = LLONG_MAX) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long binarySearch(vector<int> arr, int l, int r, int x) {
  if (r >= l) {
    long long mid = l + (r - l) / 2;
    if (arr[mid] == x) return mid;
    if (arr[mid] > x) return binarySearch(arr, l, mid - 1, x);
    return binarySearch(arr, mid + 1, r, x);
  }
  return -1;
}
template <typename T>
inline void printvec(vector<T> inp) {
  for (auto it : inp) cout << it << " ";
  cout << "\n";
}
long long n, k;
vector<long long> a;
long long dp[110][100010], pref[110][100010];
long long get2(long long nr, long long kr);
long long get(long long nr, long long kr) {
  if (nr == 0 || kr == 0) return 1;
  if (dp[nr][kr] != -1) return dp[nr][kr];
  if (nr == 1) {
    if (kr <= a[1])
      dp[nr][kr] = 1;
    else {
      dp[nr][kr] = 0;
    }
    return dp[nr][kr];
  }
  dp[nr][kr] = (get2(nr - 1, kr) - get2(nr - 1, kr - a[nr] - 1)) % 1000000007;
  return dp[nr][kr];
}
long long get2(long long nr, long long kr) {
  if (kr < 0) return 0;
  if (nr == 0 || kr == 0) return 1;
  if (pref[nr][kr] != -1) return pref[nr][kr];
  pref[nr][kr] = (get2(nr, kr - 1) + get(nr, kr)) % 1000000007;
  return pref[nr][kr];
}
int main() {
  cin >> n >> k;
  long long x;
  memset(dp, -1, sizeof(dp));
  memset(pref, -1, sizeof(pref));
  a.resize(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> a[i + 1];
  }
  cout << get(n, k) << "\n";
}
