
//#include<cstdio>
//#include<iostream>
//using namespace std;

#include<stdio.h>
#include<stdlib.h>

int a[100005];
int b[100005];
int n,m;
__int64 cost;

int comp(int *e1,int *e2){
	return *e1-*e2;
	}

int main()
{
	freopen("E.in", "r", stdin);
	freopen("E.out", "w", stdout);
	scanf("%d%d",&n,&m);
	for(int i=0; i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	for (int j = 0; j < m; j++)
	{
		scanf("%d", &b[j]);
	}
	qsort(a, n, sizeof(int), (int(*)(const void*,const void*))comp);
	qsort(b, m, sizeof(int), (int(*)(const void*,const void*))comp);
	cost = 0;
	int minimum = n < m? n:m;
	for(int i = 0; i < minimum; i++)
	{
		cost+= a[i] * b[minimum - i - 1];
	}
	printf("%d %I64d\n", minimum, cost);
	return 0;
}