#include <bits/stdc++.h>
using namespace std;
long long res[110][100100];
long long min(long long a, long long b) {
  if (a > b) return b;
  return a;
}
long long max(long long a, long long b) {
  if (a < b) return b;
  return a;
}
int main() {
  vector<long long> vec;
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    vec.push_back(a);
  }
  long long mod = 1e9 + 7;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= k; j++) {
      if (i == 0) {
        if (vec[i] >= j) res[i][j] = 1;
      } else {
        res[i][j] += res[i][j - 1] + res[i - 1][j];
        if (vec[i] < j) res[i][j] -= res[i - 1][j - vec[i]];
      }
      res[i][j] = (res[i][j] + mod) % (mod);
    }
  }
  cout << (res[n - 1][k] + mod) % (mod);
}
