#include <bits/stdc++.h>
using namespace std;

#define For(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, n) For(i, 0, n)
#define rFor(i, a, b) for(int i = (a); i >= (b); i--)
#define ALL(v) (v).begin(), (v).end()
#define rALL(v) (v).rbegin(), (v).rend()

using lint = long long;
using ld = long double;

int INF = 2000000000;
lint LINF = 1000000000000000000;

struct SetupIo {
    SetupIo() {
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        cout << fixed << setprecision(15);
    }
} setupio;

int main() {
    int n, f;
    cin >> n >> f;
    vector<int> a(n), b(n), c(n);
    rep(i, n) {
        cin >> a[i];
    }
    rep(i, n) {
        cin >> b[i];
    }
    rep(i, n) {
        cin >> c[i];
    }
    using ulint = unsigned long long;
    vector<ulint> mask(65, 0);
    For(i, 1, 65) {
        mask[i] = mask[i - 1] | (1ULL << (i - 1));
    }
    int siz = n * f / 64 + 1;
    vector<ulint> dp(siz, 0), ndp(siz, 0);
    dp[0] |= (1ULL << 63);
    rep(i, n) {
        ndp[0] = (dp[0] >> a[i]);
        For(i, 1, siz) {
            ndp[i] = (dp[i] >> a[i]);
            ndp[i] |= ((dp[i - 1] & mask[a[i]]) << (64 - a[i]));
        }
        
        ndp[0] |= (dp[0] >> b[i]);
        For(i, 1, siz) {
            ndp[i] |= (dp[i] >> b[i]);
            ndp[i] |= ((dp[i - 1] & mask[b[i]]) << (64 - b[i]));
        }
        
        ndp[0] |= (dp[0] >> c[i]);
        For(i, 1, siz) {
            ndp[i] |= (dp[i] >> c[i]);
            ndp[i] |= ((dp[i - 1] & mask[c[i]]) << (64 - c[i]));
        }
        
        swap(dp, ndp);
        
        int cnt = 0;
        rep(i, siz) {
            cnt += __popcount(dp[i]);
        }
        
        cout << cnt << "\n";
    }
}