#include <bits/stdc++.h>
const int MAX_K = 100000;
const int MOD = 1e9 + 7;
int buf[2][MAX_K + 1], s[MAX_K];
inline int add(int x, int v) { return x + v >= MOD ? x + v - MOD : x + v; }
inline int sub(int x, int v) { return x - v < 0 ? x - v + MOD : x - v; }
int main() {
  buf[0][0] = 1;
  int n, k;
  std::cin >> n >> k;
  for (int i = 1, a; i <= n; ++i) {
    auto g = buf[~i & 1];
    auto f = buf[i & 1];
    s[0] = g[0];
    for (int i = 1; i <= k; ++i) s[i] = add(s[i - 1], g[i]);
    std::cin >> a;
    for (int j = 0; j <= a; ++j) f[j] = s[j];
    for (int j = a + 1; j <= k; ++j) f[j] = sub(s[j], s[j - a - 1]);
  }
  std::cout << buf[n & 1][k];
  return 0;
}
