#include<cstdio> #include<cstdlib> #include<iostream> #include<cmath> #include<cctype> #include<algorithm> #include<cstring> using namespace std; #define MAXN 1000000+10 int pos[MAXN]; int main() { int T; scanf("%d",&T); while(T--) { int L,n; scanf("%d%d",&L,&n); int i,j,k; for(i=0;i<n;i++) scanf("%d",&pos[i]); int minn=0; for(i=0;i<n;i++) minn=max(min(L-pos[i],pos[i]),minn); int maxx=0; for(i=0;i<n;i++) maxx=max(max(L-pos[i],pos[i]),maxx); printf("%d %d\n",minn,maxx); } return 0; }