실버4 문제
n, m = map(int, input().split())
alist = []
blist = []
for _ in range(n):
a = input()
alist.append(a)
for _ in range(m):
b = input()
blist.append(b)
answer = set(alist) & set(blist)
answer = list(answer)
answer.sort()
print(len(answer))
for i in answer:
print(i)