#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  long long int k;
  cin >> n >> k;
  long long int arr[n];
  for (long long int i = 0; i < n; i++) cin >> arr[i];
  long long int dp[n + 1][k + 1];
  memset(dp, 0, sizeof(dp));
  for (long long int j = 0; j <= n; j++) dp[j][0] = 1;
  for (long long int i = 1; i <= n; i++) {
    for (long long int j = 1; j <= k; j++) {
      for (long long int m = 0; m <= arr[i - 1]; m++) {
        if (m > j) break;
        dp[i][j] = (dp[i][j] % 1000000007 + dp[i - 1][j - m] % 1000000007) %
                   1000000007;
      }
    }
  }
  for (long long int i = 0; i <= n; i++) {
    for (long long int j = 0; j <= k; j++) cout << dp[i][j] << " ";
    cout << endl;
  }
  cout << endl;
  cout << dp[n][k] % 1000000007 << endl;
  return 0;
}
