var a,b:array [1..100] of integer;an,bn,i,j,n:integer;Begin read(an,bn); for i:= 1 to an do read(a[i]); for i:= 1 to bn do read(b[i]); for i:= 1 to an do for j:= 1 to bn do if a[i]=b[j] then n:=n+1; writeln(n);End.
var a,b:array [1..100] of integer;
an,bn,i,j,n:integer;
Begin
read(an,bn);
for i:= 1 to an do
read(a[i]);
for i:= 1 to bn do
read(b[i]);
for i:= 1 to an do
for j:= 1 to bn do
if a[i]=b[j] then n:=n+1;
writeln(n);
End.