import java.util.*;
import java.math.*;
import java.io.*;
public class Main{
  static BufferedReader in;
  static StringTokenizer str=null;
  
  static int nextInt() throws Exception{
    
    if (str==null||!str.hasMoreTokens()){
      str = new StringTokenizer(in.readLine());
    }
    return Integer.parseInt(str.nextToken());
  }
  public static void main(String args[]) throws Exception{
     in = new BufferedReader(new FileReader("E.in"));
     PrintWriter out = new PrintWriter(new File("E.out"));
     int n = nextInt();
     int k = nextInt();
     int p[] = new int[n];
     int m[] = new int[k];
     for (int i=0;i<n;i++){
       p[i] = nextInt();
     }
     for (int i=0;i<k;i++){
       m[i] = nextInt();
     }
     int min = Math.min(n,k);
     Arrays.sort(p);
     Arrays.sort(m);
     long sum=0;
     for(int i=0;i<min;i++){
       sum+=p[i]*m[min-i-1];
     }
     out.println(min+" "+sum);
     out.close();
  }
}