1 #include<iostream> 2 #include<algorithm> 3 using namespace std; 4 5 int main() 6 { 7 int maxt = 0; 8 int mint = 0; 9 int n; 10 int len; 11 cin >> len >> n; 12 for (int i = 0; i < n; i++) 13 { 14 int t; 15 cin >> t; 16 maxt = max(max(len - t + 1, t), maxt); 17 mint = max(min(len - t + 1, t), mint); 18 } 19 cout << mint << " " << maxt; 20 }