#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long long solve(long long v[], long long n, long long k) {
  long long dp[n + 2][k + 2];
  for (long long j = 0; j <= k; j++) {
    dp[1][j] = (j > v[1]) ? 0 : 1;
  }
  for (long long i = 2; i <= n; i++) {
    for (long long j = 0; j <= k; j++) {
      if (j == 0)
        dp[i][j] = dp[i - 1][j];
      else
        dp[i][j] = (mod + dp[i - 1][j] + dp[i][j - 1] -
                    ((j - v[i] - 1 >= 0) ? dp[i - 1][j - v[i] - 1] : 0)) %
                   mod;
    }
  }
  for (long long i = 1; i <= n; i++) {
    for (long long j = 0; j <= k; j++) {
      cout << dp[i][j] << " ";
    }
    cout << "\n";
  }
  return dp[n][k];
}
int main() {
  long long n, k;
  cin >> n >> k;
  long long v[n + 1];
  for (long long i = 1; i <= n; i++) {
    cin >> v[i];
  }
  cout << solve(v, n, k) << endl;
  return 0;
}
