var a,b:array[1..100000] of integer; l,q,min,i,k,j,n,m,p:longint;
s:int64;
begin
assign(input,'E.in');
reset(input);
assign(output,'E.out');
rewrite(output);
readln(n,m);
for i:=1 to n do
    begin
         read(a[i]);
    end;
readln;
for i:=1 to m do
    begin
         read(b[i]);
    end;

if n>m then
begin
k:=n;
j:=m;
end
else
begin
k:=m;
j:=m;
end;
min:=a[1];  p:=1;
for i:=1 to k do
begin
if (a[i]<min) and (b[i]<>0) then
begin
     min:=a[i]; p:=1;
end;
if (b[i]<min) and (b[i]<>0) then
begin
     min:=b[i]; p:=0;
end;

end;
if p=0 then
begin
for l:=k-1 downto 2 do
    begin
         for i:=1 to l do
         begin
              if a[i]<a[i+1] then
                 begin
                      q:=a[i];
                      a[i]:=a[i+1];
                      a[i+1]:=q;
                 end;
              if b[i]>b[i+1] then
              begin
                   q:=b[i];
                   b[i]:=b[i+1];
                   b[i+1]:=q;
              end;
         end;
    end;
end
else
begin
for l:=k-1 downto 2 do
    begin
         for i:=1 to l do
         begin
              if (a[i]>a[i+1]) and (a[i+1]<>0) then
                 begin
                      q:=a[i];
                      a[i]:=a[i+1];
                      a[i+1]:=q;
                 end;
              if (b[i]<b[i+1]) and (b[i+1]<>0) then
              begin
                   q:=b[i];
                   b[i]:=b[i+1];
                   b[i+1]:=q;
              end;
         end;
    end;
end;
for i:=1 to j do
begin
s:=s+a[i]*b[i];
end;
writeln(j,' ',s);

close(input);
close(output);
end.
