#include <bits/stdc++.h>
using namespace std;
void ad(long long &a, long long b) {
  a = a + b;
  if (a >= 1000000007) a -= 1000000007;
}
void sb(long long &a, long long b) {
  a = a - b;
  if (a < 0) a += 1000000007;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, k, ub;
  cin >> n >> k;
  vector<long long> dp(k + 1, 0);
  dp[0] = 1;
  for (long long i = 0; i < n; i++) {
    cin >> ub;
    vector<long long> ref(k + 1, 0);
    for (long long j = k; j >= 0; j--) {
      long long t = dp[j];
      long long l = j + 1;
      long long r = min(j + ub, k);
      if (l <= r) {
        ad(ref[l], t);
        if (r + 1 <= k) sb(ref[r + 1], t);
      }
    }
    long long pre = 0;
    for (long long j = 0; j <= k; j++) {
      ad(pre, ref[j]);
      ad(dp[j], pre);
    }
    for (auto it : ref) cout << it << " ";
    cout << endl;
    for (auto it : dp) cout << it << " ";
    cout << endl << endl;
  }
  cout << dp[k];
  return 0;
}
