var  a,b:array[1..100010] of integer;
sum:int64;
i,j,q,n,m:longint;

function min(a,b:longint):longint;
begin
  if a<b then min:=a else min:=b;
end;


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;

    for i:=n-1 downto 1 do
    begin
      for j:=1 to i do
      begin
          if (a[j]>a[j+1]) then
          begin
            q:=a[j];
            a[j]:=a[j+1];
            a[j+1]:=q;
          end;
      end;
    end;
    for i:=m-1 downto 1 do
    begin
      for j:=1 to i do
      begin
          if (b[j]<b[j+1]) then
          begin
            q:=b[j];
            b[j]:=b[j+1];
            b[j+1]:=q;
          end;
      end;
    end;
    for i:=1 to min(n,m) do
    begin
         sum:=sum+a[i]*b[i];
    end;

    writeln(min(n,m),' ',sum);
    close(input);
    close(output);
end.
