Counting Cafeteria Menus

No attempts yetTime limit2sMemory limit256 MB

Problem

The company cafeteria can cook MM different dishes, numbered 1 through MM.

At every meal the cafeteria puts out NN of those dishes, and each employee eats one of them. The dishes served at a meal are decided by this rule.

If dish KK was served at the previous meal, dish K+1K+1 is served at this meal. If dish MM was served at the previous meal, dish 1 is served at this meal.

So every served number moves up by one from one meal to the next, and the number after MM wraps back to 1. Meals go on forever, so every menu you can reach by shifting this meal's menu again and again is served sooner or later.

Younghee just joined the company and wants to know how many different menus the cafeteria serves. She tells you the dish numbers served at this meal. Count the different menus. Two menus are the same when they hold exactly the same dish numbers.

Input

The first line contains the number of test cases TT. (1T201 \le T \le 20)

The first line of each test case contains MM, the number of dishes the cafeteria can cook, and NN, the number of dishes served at one meal. (1NM1061 \le N \le M \le 10^6)

Each of the next NN lines contains one dish number xix_i served at this meal. (1xiM1 \le x_i \le M) The numbers are distinct and sorted in increasing order.

The sum of MM over all test cases is at most 10610^6.

Output

For each test case, print the number of different menus on its own line.