#include <bits/stdc++.h>
using namespace std;
const long long MOD = (long long)1e9 + 7;
long long n, k, a[111], cnt[2][100011], sum[100011];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long x = 0;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j <= k; j++) {
      if (i == 0)
        cnt[x][j] = (a[0] >= j);
      else
        cnt[x][j] = sum[j] - (a[i] + 1 > j ? 0 : sum[j - a[i] - 1]);
    }
    sum[0] = cnt[x][0];
    for (long long j = 1; j <= k; j++) {
      sum[j] = (sum[j - 1] + cnt[x][j]) % MOD;
    }
    x ^= 1;
  }
  cout << cnt[x ^ 1][k] << endl;
  return 0;
}
