#include <bits/stdc++.h>
using namespace std;
const int N(1e5 + 9);
const int mod(1e9 + 7);
int n, m, ans;
int a[109], f[109][N], s[N];
int main() {
  cin >> n >> m;
  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++) {
    s[0] = f[i - 1][0];
    for (int j = 1; j <= m; j++) {
      s[j] = s[j - 1] + f[i - 1][j];
      s[j] %= mod;
    }
    for (int j = 1; j <= m; j++) {
      if (j > a[i])
        f[i][j] = s[j] - s[j - a[i] - 1];
      else
        f[i][j] = s[j];
      f[i][j] %= mod;
    }
  }
  cout << f[n][m] << endl;
}
