#include <bits/stdc++.h>
#pragma GCC optimize("-O2")
using namespace std;
void err(istream_iterator<string> it) { cerr << endl; }
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << "\t";
  err(++it, args...);
}
template <typename T1, typename T2>
ostream& operator<<(ostream& c, pair<T1, T2>& v) {
  c << "(" << v.first << "," << v.second << ")";
  return c;
}
template <template <class...> class TT, class... T>
ostream& operator<<(ostream& out, TT<T...>& c) {
  out << "{ ";
  for (auto& x : c) out << x << " ";
  out << "}";
  return out;
}
const int LIM = 1e5 + 5, MOD = 1e9 + 7;
int t, n, m, k, x, y;
const int maxN = 100224;
struct BIT {
  long long int data[maxN] = {0};
  void update(int idx, long long int val) {
    while (idx < maxN) {
      data[idx] = (data[idx] + val) % MOD;
      idx += idx & -idx;
    }
  }
  void update(int l, int r, long long int val) {
    update(l, val);
    update(r + 1, -val);
  }
  long long int query(int idx) {
    long long int res = 0;
    while (idx > 0) {
      res = (res + data[idx]) % MOD;
      idx -= idx & -idx;
    }
    return res;
  }
  long long int query(int l, int r) {
    return ((query(r) - query(l)) % MOD + MOD) % MOD;
  }
};
struct LazyBIT {
  BIT bitAdd, bitSub;
  void update(int l, int r, long long int val) {
    bitAdd.update(l, r, val);
    bitSub.update(l, r, (l - 1) * val % MOD);
    bitSub.update(r + 1, (MOD + (-r + l - 1) * val % MOD) % MOD);
  }
  long long int query(int idx) {
    return (idx * bitAdd.query(idx) % MOD - bitSub.query(idx)) % MOD;
  }
  long long int query(int l, int r) {
    return (MOD + (query(r) - query(l - 1)) % MOD) % MOD;
  }
} f[101];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  f[0].update(1, 1, 1);
  for (int i = 0; i < n; i++) {
    cin >> x;
    for (int j = 0; j < k + 1; j++) {
      long long int c = f[i].query(j + 1, j + 1);
      f[i + 1].update(j + 1, 1 + min(k, j + x), c);
    }
  }
  cout << f[n].query(k + 1, k + 1) << "\n";
  return 0;
}
