#include <bits/stdc++.h>
using namespace std;
const long BIG_INT = 10 ^ 9 + 7;
int N, K;
int A[100];
long dpcalc(int n, int k) {
  long dp[101][10 ^ 5 + 1] = {};
  dp[0][0] = 1;
  long rs[K + 2];
  cout << N << K << endl;
  for (int j = 1; j <= N; j++) {
    cout << j << endl;
    for (int i = 1; i <= K + 1; i++) {
      rs[i] = (rs[i - 1] + dp[j - 1][i - 1]) % BIG_INT;
    }
    cout << j << "second" << endl;
    for (int i = 0; i < K + 1; i++) {
      dp[j][i] = rs[i + 1] - rs[max(0, i - A[j - 1])];
      if (dp[j][i] < 0) {
        dp[j][i] += BIG_INT;
      }
    }
  }
  return dp[n][k];
}
int main() {
  cin >> N >> K;
  for (int j = 0; j < N; j++) {
    int a;
    cin >> a;
    A[j] = a;
  }
  cout << dpcalc(N, K) << endl;
  return 0;
}
