//对面穿过等于换一个人继续走,整体状态没变
#include<bits/stdc++.h>
using namespace std;
int l,n,maxn,minn;
int main(){
scanf("%d%d",&l,&n);
l++;
while(n--){
int x;
scanf("%d",&x);
maxn=max(maxn,max(x-0,l-x));
minn=max(minn,min(x-0,l-x));
}
cout<<minn<<" "<<maxn<<endl;
return0;
}