#include<bits/stdc++.h> using namespace std; int n,l,ans=0,tot=0; int main() { cin>>l>>n; for(int i=1;i<=n;i++) { int a; cin>>a; ans=max(min(l-a,a),ans); tot=max(max(l-a,a),tot); } cout<<ans<<" "<<tot; }
p1007独木桥