Anik is big foodie and frequently goes on outings to restaurants and food corners in the city or town he is living in. Due to the Indian government’s decision to demonetize Rs 500 and Rs 1000, Anik is in a huge scarcity for change. He cannot possibly survive without his beloved food. Notes are not available in the market, so he is having to pay only through coins. So he decides that he will pay the amount through the minimum number of coins he possibly can.
First line contains a number
T which denotes the number of test cases. Each test case contains
Awhich signifies the amount Anik has to pay.
Nwhich is the number of coin denominations available in the market.
Nintegers a1, a2, a3 ... an denoting the coin denominations available in the market.
Output should consist of a positive integer which signifies the minimum number of coins in which Anik can pay. If there exists no way in which Anik can pay, print
1 <= T <= 1000
0 <= A <= 10000
1 <= N <= 100
1 <= ai <= 1000
Rs 4 can be paid through 2 coins of Rs 2.