#include <bits/stdc++.h>
using namespace std;
int n, a[101], k;
long long f[101][100001], s[101][100001];
void read() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
}
void solve() {
  for (int j = 0; j <= a[1]; j++) f[1][j] = 1, s[1][j] = s[1][j - 1] + 1;
  for (int j = a[1] + 1; j <= k; j++) s[1][j] = s[1][j - 1];
  for (int i = 2; i <= n; i++)
    for (int j = 0; j <= k; j++) {
      f[i][j] =
          (s[i - 1][j] - s[i - 1][j - min(j, a[i])] + 1000000007) % 1000000007 +
          f[i - 1][j - min(j, a[i])] % 1000000007;
      f[i][j] %= 1000000007;
      if (a[i] >= j && f[i][j] == 0) f[i][j] = 1;
      s[i][j] = s[i][j - 1] + f[i][j] % 1000000007;
    }
  cout << f[n][k];
}
int main() {
  read();
  solve();
}
