JOI went to a Christmas party with N friends, numbered friend 1 through friend N. Once the party warmed up, JOI decided to play the following game with them.
JOI and the friends played this game M times. Compute each friend's total score after all M games.
The input has 3+M lines.
The first line contains the number of friends N (3≤N≤100).
The second line contains the number of games M (3≤M≤100).
The third line contains M integers A1,A2,…,AM separated by spaces. Ai (1≤Ai≤N) means that the target of game i is friend Ai.
The i-th of the following M lines contains N integers Bi,1,Bi,2,…,Bi,N separated by spaces. Bi,j (1≤Bi,j≤N) means that in game i, friend j wrote the name of friend Bi,j. The target writes their own name, so whenever j=Ai it holds that Bi,j=j.
Print N lines. Line j contains the total score friend j earned over the M games.