const fi='search.inp';
        fo='search.out';
        maxn=trunc(1e5);
var f,g:text;
        n,m,d:longint;
        a,b:array[1..maxn] of longint;
procedure nhap;
var i:longint;
begin
        assign(f,fi); reset(f);
        readln(f,m,n);
        for i:= 1 to m do read(f,a[i]);
        readln(f);
        for i:= 1 to n do read(f,b[i]);
        close(f);
end;
procedure sort(d,c:longint);
var i,j,mid,t:longint;
begin
        i:=d; j:=c;
        mid:=a[(d+c) div 2];
        repeat
        while (a[i]<mid) do inc(i);
        while (a[j]>mid) do dec(j);
        if (i<=j) then
        begin
                t:=a[i]; a[i]:=a[j];a[j]:=t;
                inc(i); dec(j);
        end;
        until (i>j);
        if (i<c) then sort(i,c);
        if (d<j) then sort(d,j);
end;
function tim(k:longint):boolean;
var x,y:longint;
        t:longint;
begin
        x:=1; y:=m;
        while (x<=y) do
        begin
                t:=(x+y) div 2;
                if(a[t]=k) then exit(true) else
                if(a[t]>k) then y:=t-1 else
                if(a[t]<k) then x:=t+1;
        end;
        exit(false);
end;
procedure xuly;
var i:longint;
begin
        sort(1,m);
        d:=0;
        for i:= 1 to n do if(tim(b[i])) then inc(d);
end;
procedure xuat;
begin
        assign(g,fo);
        rewrite(g);
        writeln(g,d);
        close(g);
end;
begin
        nhap;
        xuly;
        xuat;
end.