n, f = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

N = 0
L = 60
for i in range(n):
    N += max(A[i], B[i], C[i])
dp = [0 for _ in range(((N+1)//L)+1)]
dp[0] |= 1
K = ((N+1)//L)+1

    
def popcnt3(n):
    c = (n & 0x5555555555555555) + ((n>>1) & 0x5555555555555555)
    c = (c & 0x3333333333333333) + ((c>>2) & 0x3333333333333333)
    c = (c & 0x0f0f0f0f0f0f0f0f) + ((c>>4) & 0x0f0f0f0f0f0f0f0f)
    c = (c & 0x00ff00ff00ff00ff) + ((c>>8) & 0x00ff00ff00ff00ff)
    c = (c & 0x0000ffff0000ffff) + ((c>>16) & 0x0000ffff0000ffff)
    c = (c & 0x00000000ffffffff) + ((c>>32) & 0x00000000ffffffff)
    return c

for i in range(n):
    ndp = [0 for _ in range(((N+1)//L)+1)]
    ans = 0
    for j in range(K):
        tmp = dp[j] << L
        if j:
            tmp |= dp[j-1]
        now = tmp << A[i] | tmp << B[i] | tmp << C[i]
        ndp[j] = now >> L
        ans += popcnt3(ndp[j])
    print(ans)
    dp = ndp