import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Collections;
import java.util.Scanner;
import java.util.Vector;

public class Main {
    public static void main(String[] args) {
        try {
            Scanner in = new Scanner(new FileReader("E.in"));
            PrintWriter out = new PrintWriter(new FileWriter("E.out"));
            Vector<Integer> v1 = new Vector<Integer>();
            Vector<Integer> v2 = new Vector<Integer>();
            int sum=0;
            int n=0;
            int m=0;
            int  min =0;
            n = in.nextInt();
            m = in.nextInt();
            min = Math.min(n, m);
            for(int i=0; i<n; i++)
                v1.addElement(in.nextInt());
            for(int i=0; i<m; i++)
                v2.addElement(in.nextInt());
            in.close();
            Collections.sort(v1);
            Collections.sort(v2);
            for (int i=0; i<min; i++){
                sum+=v1.elementAt(i)*v2.elementAt(min-i-1);                
            }
            out.println(min+" "+sum);
            out.close();
        } catch (IOException ex) {
		ex.printStackTrace();
        }        
    }
}
