#include <cstdio>
#include <iostream>
#define MAXN 100001
using namespace std;

int n,k;
long A[MAXN],B[MAXN];

void  sortA(int ll, int rr){
	int i = ll, j = rr, d = A[(i+j)/2], c;
	do{
		while (A[i] < d)i++;
		while (A[j] > d)j--;
		if (i <= j){ c = A[i]; A[i] = A[j]; A[j] =c; i++; j--;}
	}while(i<j);
	if (i < rr) sortA(i,rr);
	if (ll < j) sortA(ll,j);
}

void  sortB(int ll, int rr){
	int i = ll, j = rr, d = B[(i+j)/2], c;
	do{
		while (B[i] < d)i++;
		while (B[j] > d)j--;
		if (i <= j){ c = B[i]; B[i] = B[j]; B[j] =c; i++; j--;}
	}while(i<j);
	if (i < rr) sortB(i,rr);
	if (ll < j) sortB(ll,j);
}


int main(){
	freopen("E.in","r",stdin); freopen("E.out","w",stdout);
	scanf("%d %d",&n,&k);
	for (int i = 0; i < n; i++) scanf("%d",&A[i]);
	for (int i = 0; i < k; i++) scanf("%d",&B[i]);
	sortA(0,n-1);
	sortB(0,k-1);
	int z = (n < k) ? n : k;
	cout << z << " ";
	__int64 sum = 0;
	for (int i = 0; i < z; i++) sum = sum + A[i]*B[k-1-i];
	cout << sum <<endl;
	fclose(stdin); fclose(stdout);
	return 0;       
}