Hide

Problem F
Books

DreamGrid went to the bookshop yesterday. There are $n$ books in the bookshop in total. Because DreamGrid is very rich, he bought the books according to the strategy below:

  • Check the $n$ books from the 1st one to the $n$-th one in order.

  • For each book being checked now, if DreamGrid has enough money (not less than the book price), he’ll buy the book and his money will be reduced by the price of the book.

  • In case that his money is less than the price of the book being checked now, he will skip that book.

BaoBao is curious about how rich DreamGrid is. BaoBao only knows the prices of the $n$ books and the total number of books $m$ purchased by DreamGrid. Help BaoBao determine the maximum amount of money DreamGrid could have had at the start of his shopping trip.

Input

There are multiple test cases. The first line of the input contains an integer $T$, indicating the number of test cases. For each test case:

The first line contains two integers $n$ and $m$ ($1 \le n \le 10^5$, $0 \le m \le n$), indicating the number of books in the bookshop and the number of books DreamGrid bought in total.

The second line contains $n$ non-negative integers $a_1, a_2, ... , a_ n$ ($0 \le a_ i \le 10^9$), where $a_ i$ indicates the price of the $i$-th book checked by DreamGrid.

It’s guaranteed that the sum of $n$ in all test cases will not exceed $10^6$.

Output

For each test case output one line.

If it is impossible to buy $m$ books for any initial amount of money, output “Impossible” (without quotes).

Otherwise, if there are arbitrarily large values $v$ such that if DreamGrid would have bought $m$ books starting with $v$ money, output “Richman” (without quotes).

In other cases, output a single non-negative integer indicating the maximum amount of money $v$ DreamGrid could have taken that would have caused him to buy exactly $m$ books.

Sample Input 1 Sample Output 1
4
4 2
1 2 4 8
4 0
100 99 98 97
2 2
10000 10000
5 3
0 0 0 0 1
6
96
Richman
Impossible

Please log in to submit a solution to this problem

Log in