#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;}
template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;}

void Solve(){
    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];
    bitset<900001>BS;
    BS[0]=1;
    int now=0;
    for(int i=0;i<N;i++){
        BS=(BS<<A[i])|(BS<<B[i])|(BS<<C[i]);
        cout<<BS.count()<<"\n";
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    Solve();
}