import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.Arrays;
import java.util.Scanner;


public class Main {

	static final String task = "e";
	
	public static void main(String[] args) throws Exception {
		//Scanner in = new Scanner(new FileReader(task+".in"));
		StreamTokenizer in = new StreamTokenizer(new FileReader(task+".in"));
		
		PrintWriter out = new PrintWriter(new File(task+".out"));
		
		in.nextToken();
		int n = (int)in.nval;
		in.nextToken();
		int m = (int)in.nval;
		
		int[] a = new int [n];
		for (int i = 0; i < n; i++) {
			in.nextToken();
			a[i] = (int)in.nval;
		}
		
		int[] b = new int [m];
		for (int i = 0; i < m; i++) {
			in.nextToken();
			b[i] = (int)in.nval;
		}
		
		Arrays.sort(a);
		Arrays.sort(b);
		
		int t = Math.min(n, m);
		long res1 = 0;
		long res2 = 0;
		
		
		for (int i = 0; i < t; i++) {
			res1 += a[i]*b[m-i-1];
			res2 += a[n-i-1]*b[i];
		}
		out.print(t+" "+Math.min(res1,res2));
		out.close();
	}

}
