#include using namespace std; #define TRACE(x) cerr << __LINE__ << ": " << #x << " = " << x << endl #define _ << " _ " << template struct is_container : false_type {}; template struct is_container> : true_type {}; template struct is_container> : true_type {}; template struct is_container> : true_type {}; template struct is_container> : true_type {}; template struct is_container> : true_type {}; template struct is_container> : true_type {}; template struct is_container> : true_type {}; template::value>::type> ostream& operator<<(ostream &o, T x) { int f = 1; o << "{"; for (auto y : x) { o << (f ? "" : ", ") << y; f = 0; } return o << "}"; } template ostream& operator<<(ostream &o, pair x) { return o << "(" << x.first << ", " << x.second << ")"; } #define fi first #define se second typedef long long ll; typedef long double ld; typedef pair pii; typedef pair pll; typedef vector vi; typedef vector vll; const int MAX = 405; const int MOD = 167772161; int mul(int a, int b) { return (long long)a * b % MOD; } int sub(int a, int b) { return b > a ? a - b + MOD : a - b; } int add(int a, int b) { return a + b >= MOD ? a + b - MOD : a + b; } vector add_to_dp(vector dp, int W) { vector new_dp = dp; for (int i = 1; i < MAX; i++) for (int j = W; j < MAX; j++) new_dp[i][j] = add(new_dp[i][j], dp[i - 1][j - W]); return new_dp; } vector remove_from_dp(vector dp, int W) { vector new_dp = dp; for (int i = 1; i < MAX; i++) for (int j = W; j < MAX; j++) new_dp[i][j] = sub(new_dp[i][j], new_dp[i - 1][j - W]); return new_dp; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; vi W(n); for (int i = 0; i < n; i++) cin >> W[i]; vector dp(MAX, vi(MAX)); dp[0][0] = 1; for (int i = 0; i < n; i++) dp = add_to_dp(dp, W[i]); for (int i = 0; i < n; i++) { dp = remove_from_dp(dp, W[i]); for (int j = 1; j < n; j++) { int sol = 0; for (int w = k - W[i] + 1; w <= k; w++) sol = add(sol, dp[j][w]); cout << sol << ' '; } cout << '\n'; dp = add_to_dp(dp, W[i]); } return 0; }