{"trustable":true,"prependHtml":"\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eDreamGrid 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:\r\n\r\n\u003c/p\u003e\u003cul\u003e\r\n \u003cli\u003eCheck the $n$ books from the 1st one to the $n$-th one \u003cb\u003ein order\u003c/b\u003e.\u003c/li\u003e\r\n \u003cli\u003eFor each book being checked now, if DreamGrid has enough money (not less than the book price), he\u0027ll buy the book and his money will be reduced by the price of the book.\u003c/li\u003e\r\n \u003cli\u003eIn case that his money is less than the price of the book being checked now, he will skip that book.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\r\n\u003cp\u003eBaoBao is curious about how rich DreamGrid is. You are asked to tell him the maximum possible amount of money DreamGrid took before buying the books, which is a non-negative integer. All he knows are the prices of the $n$ books and the number of books DreamGrid bought in total, indicated by $m$. \u003c/p\u003e\r\n\r\n\u003ch4\u003eInput\u003c/h4\u003e\r\n\u003cp\u003eThere are multiple test cases. The first line of the input contains an integer $T$, indicating the number of test cases. For each test case:\u003c/p\u003e\r\n\r\n\u003cp\u003eThe 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.\u003c/p\u003e\r\n\r\n\u003cp\u003eThe second line contains $n$ non-negative integers $a_1, a_2, \\dots, a_n$ ($0 \\le a_i \\le 10^9$), where $a_i$ indicates the price of the $i$-th book checked by DreamGrid.\u003c/p\u003e\r\n\r\n\u003cp\u003eIt\u0027s guaranteed that the sum of $n$ in all test cases will not exceed $10^6$.\u003c/p\u003e\r\n\r\n\u003ch4\u003eOutput\u003c/h4\u003e\r\n\u003cp\u003eFor each test case output one line.\u003c/p\u003e\r\n\r\n\u003cp\u003eIf it\u0027s impossible to buy $m$ books for any initial number of money, output \"Impossible\" (without quotes).\u003c/p\u003e\r\n\r\n\u003cp\u003eIf DreamGrid may take an infinite amount of money, output \"Richman\" (without quotes).\u003c/p\u003e\r\n\r\n\u003cp\u003eIn other cases, output a non-negative integer, indicating the maximum number of money he may take.\u003c/p\u003e\r\n\r\n\u003ch4\u003eSample\u003c/h4\u003e\n\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e4\r\n4 2\r\n1 2 4 8\r\n4 0\r\n100 99 98 97\r\n2 2\r\n10000 10000\r\n5 3\r\n0 0 0 0 1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e6\r\n96\r\nRichman\r\nImpossible\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n"}}]}