#include using namespace std; int main() { int x, n; int left = 0, right = 0; int min = 101, max = -101; cin >> x >> n; for(int i = 0; i < n; i++) { int position; cin >> position; if(position <= x) left++; else right++; if(position < min) min = position; if(position > max) max = position; } if(left < right) { cout << right << " " << max; } else { cout << left << " " << min; } return 0; }