n, m = map(int, input().split()) cnt = {} for x in map(int, input().split()): if x in cnt: cnt[x] += 1 else: cnt[x] = 1 c = [cnt[x] if x in cnt else 0 for x in map(int, input().split())] print(*c)