program zade;

{$APPTYPE CONSOLE}

var
  a,b:array[1..1000] of integer;
  i,j,k,r,z:integer;
  n,m,c,s:integer;
  min,newmon,newblock:integer;
begin
  assignfile(input,'input.txt');
  reset(input);
  assignfile(output,'output.txt');
  rewrite(output);
  read(n,m);
  fillchar(a,n,0);
  fillchar(b,m,0);
  for i:=1 to n do
    begin
      read(c);
      a[c]:=a[c]+1;
    end;
  for j:=1 to m do
    begin
      read(c);
      b[c]:=b[c]+1;
    end;
  min:=n;
  if min>m then
     min:=m
    else
      begin
        for i:=1 to m-n do
          begin
            for j:=1000 downto 1 do
              if b[j]<>0 then
                begin
                  b[j]:=b[j]-1;
                  break;
                end;
          end;
      end;

  j:=1;
  k:=1000;
  s:=0;
  for i:=1 to min do
    begin
      for r:=j to 1000 do
        if a[r]<>0 then break;
      a[r]:=a[r]-1;
      if a[r]=0 then j:=j+1;
      for z:=k downto 1 do
        if b[z]<>0 then break;
      b[z]:=b[z]-1;
      if b[z]=0 then k:=k-1;
      s:=s+z*r;
    end;
  write(min,' ',s);
  closefile(output);
end.
