uses
	SysUtils,Math;
var
	a , b : array[ 1..100000 ] of longint;
	c , N , M , i : longint;
	mult , sum : int64;

procedure qsorta( l , r : longint );
var
	i , j , k , y : longint;

begin
 i := l;
 j := r;
 k := a[ ( l + r ) div 2 ];
 repeat
  while a[ i ] < k do
   inc( i );
  while a[ j ] > k do
   dec( j );
  if i <= j then
   begin
    y := a[ i ];
    a[ i ] := a[ j ];
    a[ j ] := y;
    inc( i );
    dec( j );
   end;
 until i > j;
 if i < r then
  qsorta( i , r );
 if l < j then
  qsorta( l , j );
end;

procedure qsortb( l , r : longint );
var
	i , j , k , y : longint;

begin
 i := l;
 j := r;
 k := b[ ( l + r ) div 2 ];
 repeat
  while b[ i ] < k do
   inc( i );
  while b[ j ] > k do
   dec( j );
  if i <= j then
   begin
    y := b[ i ];
    b[ i ] := b[ j ];
    b[ j ] := y;
    inc( i );
    dec( j );
   end;
 until i > j;
 if i < r then
  qsortb( i , r );
 if l < j then
  qsortb( l , j );
end;

begin
 assign( input , 'E.in' );
  reset( input );
 assign( output , 'E.out' );
  rewrite( output );
 sum := 0;
 readln( N , M );
 for i := 1 to N do
  read( a[ i ] );
 for i := 1 to M do
  read( b[ i ] );
 c := min( M , N );
 qsorta( 1 , c );
 qsortb( 1 , c );
 for i := 1 to c do
  begin
   mult := b[ c - i + 1 ] * a[ i ];
   sum := sum + mult;
  end;
 writeln( c , ' ' , sum );
 close( output );
end.