import collections class Io: def __init__(self): self.tokens_index = 0 self.tokens = [] def next_line(self): assert self.tokens_index >= len(self.tokens) return input() def next(self): if self.tokens_index < len(self.tokens): token = self.tokens[self.tokens_index] self.tokens_index += 1 return token else: self.tokens = self.next_line().split() self.tokens_index = 0 return self.next() def next_int(self): return int(self.next()) def next_float(self): return float(self.next()) def main(): io = Io() n = io.next_int() m = io.next_int() c = collections.Counter(io.next_int() for i in range(n)) print(' '.join(str(c[io.next_int()]) for i in range(m))) if __name__ == '__main__': main()