#include <bits/stdc++.h>
using namespace std;
main()
{
int x,n,i,l=0,r=0,tempmax,tempmin;
cin >> x >> n;
int y[n];
for (i=0;i < n;i++)
cin >> y[i];
tempmax = x;tempmin = x;
for (i=0; i < n;i++)
{
if (y[i] > x)
r++;
else
l++;
}
if ( l > r )
{
for (i = 0;i < n;i++)
{
if ( y[i] < tempmin)
tempmin = y[i];
}
cout << l << " "<< tempmin<<endl;
}
else
{
for (i = 0;i < n;i++)
{
if ( y[i] > tempmax)
tempmax = y[i];
}
cout << r << " "<< tempmax<<endl;
}
return 0;
}