//生成AIを用いてPythonからC++に変換しました
#include <iostream>
#include <vector>
#include <bitset>
#include <algorithm>  // std::max を使うために追加
#include <cstdint>    // uint64_t を使うために追加

using namespace std;

const int L = 63;
const int MAX_N = 15000;
const int MAX_F = 60;
const int MAX_SUM = MAX_N * MAX_F;
const int BITSET_SIZE = (MAX_SUM / L) + 1;  // 63ビットごとに管理

vector<uint64_t> dp(BITSET_SIZE, 0);
uint64_t T = (1ULL << L) - 1;  // 63ビット分のマスク

// ビットの立っている数をカウント(popcnt)
int popcnt3(uint64_t n) {
    return __builtin_popcountll(n);  // GCC/Clang の組み込み関数
}

int main() {
    int n, f;
    cin >> n >> f;
    vector<int> A(n), B(n), C(n);
    
    for (int i = 0; i < n; ++i) cin >> A[i];
    for (int i = 0; i < n; ++i) cin >> B[i];
    for (int i = 0; i < n; ++i) cin >> C[i];

    int N = 0;
    for (int i = 0; i < n; ++i) {
        N += max(A[i], max(B[i], C[i]));  // 修正: max を 2 回使う
    }

    dp[0] |= 1;  // 初期状態(和が 0 は可能)

    for (int i = 0; i < n; ++i) {
        vector<uint64_t> ndp(BITSET_SIZE, 0);
        uint64_t tmp = 0;
        int ans = 0;

        for (int j = 0; j < BITSET_SIZE; ++j) {
            tmp |= (dp[j] << A[i]) | (dp[j] << B[i]) | (dp[j] << C[i]);
            ndp[j] = tmp & T;
            tmp >>= L;
            ans += popcnt3(ndp[j]);
        }

        cout << ans << '\n';
        dp = ndp;  // 更新
    }

    return 0;
}