n, m=map(int, input().split()) s={} for i in range(n): st=input() s[st]=i ans=0 for _ in range(m): if input() in s.keys(): ans+=1 print(ans)