You are given Pi kg of a cereal in different boxes daily and you hate it. You can daily choose any of the cereal boxes you have and remove 10 % of amount of the cereals in the box or K kg whichever is more. If the box you choose has less than K Kg of cereal left in it, you can empty the box. Your task is to minimize the amount of cereals you have with yourself at the end of N days.
The first line of the input contains an integer T denoting number of test cases. First line of each test case contains two integers N and K. Second line of the test case contains N space separated integer Pi denoting the amount of cereals (in kg) which you are given on the ith day.
For each test case, if W is the amount of cereals you have left with yourself at the end, print the highest integer less than or equal to W.
You will remove 10 kg from the first box on first day and second day.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.