import java.io.*;
import java.util.*;

public class Main implements Runnable{
 StreamTokenizer in;
 BufferedReader bin;
 PrintWriter out;
 public static void main(String[] args){
  new Thread(new Main()).start();
 }
 public void run(){
  try{
   bin=new BufferedReader(new FileReader("E.in"));
   in=new StreamTokenizer(bin);
   out=new PrintWriter(new FileWriter("E.out"));
   Locale.setDefault(Locale.US);
   solve();
   out.flush();
  }catch(IOException ex){
   throw new IllegalStateException(ex);
  }
 }
 int nextInt() throws IOException{
  in.nextToken();
  return (int)in.nval;
 }
 void solve() throws IOException{
  int n=nextInt(),m=nextInt();
  int as[]=new int[1005];
  int bs[]=new int[1005];
  int a[]=new int[n];
  int b[]=new int[m];
  for(int i=0;i<n;i++){
   as[nextInt()]++;
  }
  for(int i=0;i<m;i++){
   bs[nextInt()]++;
  }
  int k=0;
  for(int i=0;i<1005;i++){
   while(as[i]>0){
    a[k++]=i;
    as[i]--;
   }
  }
  k=0;
  for(int i=0;i<1005;i++){
   while(bs[i]>0){
    b[k++]=i;
    bs[i]--;
   }
  }
  long s=0;
  int min=(n<m)?n:m;
  for(int i=0;i<min;i++){
   s+=a[i]*b[min-i-1];
  }
  out.println(min+" "+s);
 }
}