#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
const int M = 1e9 + 7;
long long f[107][N], a[N];
int n, k;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 0; i <= n; ++i) f[i][0] = 1;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= k; ++j) {
      f[i][j] = (f[i][j - 1] + f[i - 1][j] -
                 (j >= a[i] + 1 ? f[i - 1][j - a[i] - 1] : 0)) %
                M;
    }
  cout << f[n][k];
  return 0;
}
