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