#include <bits/stdc++.h>
using namespace std;
const int maxk = 1e5 + 10;
const int maxn = 110;
long long dp[maxk][maxn];
int n, k;
long long mod = 1e9 + 7;
void add(long long &a, long long b) {
  a += b;
  if (a >= mod) a -= mod;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> k;
  vector<long long> nms(n + 1);
  for (long long i = 0; i < n; i++) cin >> nms[i + 1];
  dp[0][0] = 1;
  vector<long long> ps(k + 1);
  for (long long i = 0; i < n + 1; i++) {
    for (long long j = 0; j < k + 1; j++) {
      long long cur = ps[j];
      if (j - nms[i] - 1 >= 0) cur -= ps[j - nms[i] - 1];
      add(dp[j][i], cur);
    }
    ps[0] = dp[0][i];
    for (long long j = 0; j < k + 1; j++)
      if (j) ps[j] = 0, add(ps[j], ps[j - 1] + dp[j][i]);
  }
  cout << ((dp[k][n] + mod) % mod) << endl;
}
