You are given P_{i} 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.

**Input:**

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 P_{i} denoting the amount of cereals (in kg) which you are given on the i^{th} day.

**Output:**

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.

**Constraints:**

1<=T<=3.3*10^3

1<=N<=10^3

1<=K<=10^2

1<=P_{i}<=10^3

**Example:**

**Input:**

1

2 10

100 15

**Output:**

95

**Explanation:**

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.

Sulagna | 117 |

RUTVIKHARIPARA | 116 |

janvidavda105190 | 93 |

harshsiddhapura105461 | 93 |

devsinghindra | 80 |

PiyushPandey4 | 614 |

ASWATHAMA | 561 |

akhyasharma01 | 547 |

john_wick | 521 |

jagrit_07 | 443 |

blackshadows | 5362 |

Ibrahim Nash | 5242 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4598 |

Login to report an issue on this page.