#include <iostream>
#include <cmath>
#include <fstream>
#include <sstream>
#include <set>
#include <vector>
#include <map>
#include <deque>
#include <stack>
#include <algorithm>
#include <string>
#include <functional>
#include <time.h>

using namespace std;

int a[100000], b[100000];

int main()
{
freopen("E.in", "r", stdin);
freopen("E.out", "w", stdout);
int n,m;
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]);

sort(a,a+n);
sort(b,b+m);

int board = n;
if(m<n) board = m;

long long sum = 0;
sort(b,b+board, greater<int>());
for(int i=0; i<board; i++)
	sum+=a[i]*b[i];
cout<<board<<" "<<sum<<endl;
return 0;
}
