n,m=map(int, input().split()) s,ss=[],[] for _ in range(n): s.append(input()) for _ in range(m): ss.append(input()) s=set(s)#집합 ss=set(ss) re=sorted(s&ss)#교집합 print(len(re))#개수 for i in re: print(i)
접근 방법