import java.util.*;
class Main2 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t=sc.nextInt();
while(t-->0) {
int rope=sc.nextInt();
int n=sc.nextInt();
int dis=0;
int minTime=0;
int curMinTime=0;
int maxTime=0;
int curMaxTime=0;
for (int i = 0; i < n; i++) {
dis=sc.nextInt();
if(dis>rope/2) curMinTime=rope-dis;
else curMinTime=dis;
if(curMinTime>minTime)minTime=curMinTime;
if(dis>rope/2) curMaxTime=dis;
else curMaxTime=rope-dis;
if(curMaxTime>maxTime)maxTime=curMaxTime;
}
System.out.println(minTime+" "+maxTime);
}
}
}
|