개미가 부디칠 경우 통과한다고 보고 작성.,
속도는 O(n)
import java.util.Scanner;
public class P1852 {
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		int testcase;
		Scanner scan = new Scanner(System.in);
		testcase = scan.nextInt();
		while (testcase– > 0)
		{
			int l = scan.nextInt();
			int n = scan.nextInt();
			int max = 0;
			int min = 0;
			for (int i=0; i<n; i++)
			{
				int t = scan.nextInt();
				max = Math.max(max, Math.max(l-t, t));
				min = Math.max(min, Math.min(l-t, t));
			}
			System.out.println(min + ” ” + max);
		}
	}
}
 
         
        