#include <bits/stdc++.h>
using namespace std;
const int maxn = 102;
const int maxm = 100002;
const int mo = 1e9 + 7;
int n, m, f[maxn][maxm], d[maxn];
void add(int &a, int b) {
  a += b;
  a %= mo;
}
void sub(int &a, int b) {
  a = a - b + mo;
  a %= mo;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    cin >> d[i];
  }
  f[0][0] = 1;
  int sum = 0;
  for (int i = 1; i <= n; ++i) {
    sum += d[i];
    for (int j = 0; j <= sum && j <= m; ++j) {
      f[i][j] = f[i - 1][j];
      if (j > 0) add(f[i][j], f[i][j - 1]);
      if (j - 1 >= d[i]) sub(f[i][j], f[i][j - 1 - d[i]]);
    }
  }
  cout << f[n][m] << endl;
  return 0;
}
