import collections N,M = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) c = collections.Counter(A) for b in B: print(c[b], end=' ') print()