1-> <- 2 相撞后 为 <- 1 2-> 转化为 <-2 1->
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner (System.in);
while(sc.hasNext()) {
int n = sc.nextInt();
while(n-->0) {
int len = sc.nextInt();
int length = sc.nextInt();
int arr [] = new int [length];
int min = 0;
int max = 0;
for(int i = 0 ; i < length ; i++) {
arr[i] = sc.nextInt();
min = Math.max(min, Math.min(arr[i], len-arr[i]));
max = Math.max(max, Math.max(arr[i], len-arr[i]));
}
System.out.println(min+" "+max);
}
}
}
}