uses
	testlib, sysutils;

type
	tarr = array [1..100000] of longint;

var
	jv, pv: tarr;
	ja, pa: longint;
	i: longint;

procedure sort(var a: tarr; l, r: longint);
var
	i, j: longint;
	x, y: longint;
begin
	i := l;
	j := r;
	x := a[i + random(j - i + 1)];
	while (i <= j) do begin
		while (a[i] < x) do inc(i);
		while (a[j] > x) do dec(j);
		if (i <= j) then begin
			y := a[i]; a[i] := a[j]; a[j] := y;
			inc(i);
			dec(j);
		end;
	end;
	if (i < r) then
		sort(a, i, r);
	if (l < j) then
		sort(a, l, j);
end;

begin
	ja := ans.readlongint;
	pa := ouf.readlongint;

	if ja <> pa then
		quit(_wa, format('wrong count, expected: %d, found: %d', [ja, pa]));

   	for i := 1 to ja do begin
   		jv[i] := ans.readlongint;
   	end;
   	sort(jv, 1, ja);

   	for i := 1 to pa do begin
   		pv[i] := ouf.readlongint;
   	end;
   	sort(pv, 1, pa);

   	for i := 1 to pa do begin
   		if jv[i] <> pv[i] then
   			quit(_wa, 'wrong important roads');
   	end;

   	quit(_ok, format('%d important roads', [pa]));
end.	
