{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n h1 { font-size: 1.2em; }\n\u003c/style\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\n\u003cdiv class\u003d\"md\"\u003e\u003cp\u003eConsider a money system consisting of \u003cspan class\u003d\"math inline\"\u003e$ n $\u003c/span\u003e coins. Each coin has a positive integer value. Your task is to produce a sum of money \u003cspan class\u003d\"math inline\"\u003e$ x $\u003c/span\u003e using the available coins in such a way that the number of coins is minimal.\u003c/p\u003e\n\u003cp\u003eFor example, if the coins are \u003cspan class\u003d\"math inline\"\u003e$ \\{1,5,7\\} $\u003c/span\u003e and the desired sum is \u003cspan class\u003d\"math inline\"\u003e$ 11 $\u003c/span\u003e, an optimal solution is \u003cspan class\u003d\"math inline\"\u003e$ 5+5+1 $\u003c/span\u003e which requires \u003cspan class\u003d\"math inline\"\u003e$ 3 $\u003c/span\u003e coins.\u003c/p\u003e\n\u003ch1 id\u003d\"input\"\u003eInput\u003c/h1\u003e\n\u003cp\u003eThe first input line has two integers \u003cspan class\u003d\"math inline\"\u003e$ n $\u003c/span\u003e and \u003cspan class\u003d\"math inline\"\u003e$ x $\u003c/span\u003e: the number of coins and the desired sum of money.\u003c/p\u003e\n\u003cp\u003eThe second line has \u003cspan class\u003d\"math inline\"\u003e$ n $\u003c/span\u003e distinct integers \u003cspan class\u003d\"math inline\"\u003e$ c_1,c_2,\\dots,c_n $\u003c/span\u003e: the value of each coin.\u003c/p\u003e\n\u003ch1 id\u003d\"output\"\u003eOutput\u003c/h1\u003e\n\u003cp\u003ePrint one integer: the minimum number of coins. If it is not possible to produce the desired sum, print \u003cspan class\u003d\"math inline\"\u003e$ -1 $\u003c/span\u003e.\u003c/p\u003e\n\u003ch1 id\u003d\"constraints\"\u003eConstraints\u003c/h1\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cspan class\u003d\"math inline\"\u003e$ 1 \\le n \\le 100 $\u003c/span\u003e\u003c/li\u003e\n\u003cli\u003e\u003cspan class\u003d\"math inline\"\u003e$ 1 \\le x \\le 10^6 $\u003c/span\u003e\u003c/li\u003e\n\u003cli\u003e\u003cspan class\u003d\"math inline\"\u003e$ 1 \\le c_i \\le 10^6 $\u003c/span\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch1 id\u003d\"example\"\u003eExample\u003c/h1\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\u003e3 11\n1 5 7\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e "}}]}