{$ifdef fpc} {$mode delphi} {$endif}
{$apptype console}
{$s+,i+,r+,q+,v+,d+,l+,o-}
const
	filein = 'E.in';
	fileout = 'E.out';
	maxn = 100000;
type
	list = array[0..maxn]of longint;
var
	a,b: list;
	n,m,i: longint; ans: int64;

function min(x,y: longint): longint;
begin
	if x < y then result := x
	else result := y;
end;

procedure sort(var m: list; l,r: longint);
var
	i,j,x: longint;
begin
	if not (l < r) then exit;
   	i := random(r - l + 1) + l; m[0] := m[i]; m[i] := m[l]; m[l] := m[0];
	i := l - 1; j := r + 1; x := m[l];
	while i < j do begin
		repeat inc(i) until m[i] >= x;
		repeat dec(j) until m[j] <= x;
		if i < j then begin
			m[0] := m[i]; m[i] := m[j]; m[j] := m[0];
		end;
	end;
	sort(m,l,j); sort(m,j + 1,r);
end;

begin
	assign(input,filein);reset(input);assign(output,fileout);rewrite(output);
	read(n,m);
	for i := 1 to n do read(a[i]);
	for i := 1 to m do read(b[i]);

	sort(a,1,n);
	sort(b,1,m);

	ans := 0;
	for i := 1 to min(n,m) do
		ans := ans + int64(a[i]) * b[min(n,m) - i + 1];
	writeln(min(n,m),' ',ans);
	close(output);
end.