Osmos (Large)

Starting from size A, absorb the sorted motes in order and use the fewest added or removed motes to clear each blocker.

Medium5GreedySortingInterviewNo attempts yetTime limit5sMemory limit512 MB

Problem

Armin plays a game about motes. A mote is a small particle that absorbs other motes, or is absorbed by them.

Armin controls one mote. His mote absorbs another mote only if the other mote is strictly smaller. A mote of exactly the same size cannot be absorbed. Absorbing a mote adds that mote's size to Armin's mote, so his mote grows and may then absorb motes it could not touch before.

For example, suppose Armin's mote has size 1010 and the other motes have sizes 99, 1313 and 1919. At the start his mote can absorb only the mote of size 99, which brings it to size 1919. Then it absorbs the mote of size 1313 and reaches size 3232, and only then can it absorb the last mote.

You prepare the motes Armin plays against. The size of Armin's mote and the sizes of the other motes are already fixed, and that set may leave no way for his mote to absorb everything. You may repair it with two operations, used in any order and any number of times: add a new mote of any positive integer size, or remove one of the existing motes.

Report the minimum number of operations that makes it possible for Armin's mote to absorb every other mote.

For example, if Armin's mote has size 1010 and the other motes are 99, 2020, 2525 and 100100, the game is not solvable as it stands. Adding a mote of size 33 and removing the mote of size 100100 solves it in two operations, so the answer is 22.

Input

The first line has the number of games TT. Each game takes two lines. The first line has the size of Armin's mote AA and the number of other motes NN. The second line has the NN sizes of the other motes, separated by spaces. Every size is an integer.

  • 1T1001 \le T \le 100
  • 1A1061 \le A \le 10^6
  • 1N1001 \le N \le 100
  • every other mote size is between 11 and 10610^6

Output

For each game print one line in the form Case #x: y, where xx is the game number starting at 11 and yy is the minimum number of operations that solves that game.

Notes

The sizes given in the input are at most 10610^6, but Armin's mote can grow past that bound while it absorbs. A mote you add has no upper bound either, it only has to be a positive integer.