#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>
#include<map>
#include<vector>

using namespace std;

int a[101000],b[101000];

int main() {
	freopen("E.in","r",stdin);
	freopen("E.out","w",stdout);
	int n,k;
	scanf("%d%d",&n,&k);
	for (int i=0; i < n; i++)
		scanf("%d",&a[i]);
	for (int j=0; j < k; j++)
		scanf("%d",&b[j]);
	int ans1=min(n,k);
	sort(a,a+n);
	sort(b,b+k);
	long long ans2=0;
	for (int j=0; j < ans1; j++)
		ans2+=(a[j]*b[ans1-j-1]);
	printf("%d %I64d\n",ans1,ans2);
		


	return 0;
}
