After the Indian government’s decision to ban/demonetize Rs 500 and Rs 1000 note, people were facing difficulties in paying the amount at different shops. Mr. Seth was one of those, he went to a food plaza and want to eat tasty and crispy food. As notes were not available in the market so he has to pay using coins. So he decides that he will pay the amount through the minimum number of coins he possibly can.
Input:
First-line contains a number-T,
which denotes the number of test cases. Each test case contains 3 lines.
A
which signifies the amount Anik has to pay.N
integers a1, a2, a3 ... an denoting the coin denominations available in the market.Output:
The output should consist of a positive integer which signifies the minimum number of coins in which Mr. Seth can pay. If there exists no way in which he can pay, print No solution
.
Constraints:
1 <= T <= 1000
0 <= A <= 10000
1 <= N <= 100
Rs 4 can be paid through 2 coins of Rs 2.