Farmer John has gone to town to buy some farm supplies. Being a very efficient man, he always pays for his goods in such a way that the smallest number of coins changes hands, i.e., the number of coins he uses to pay plus the number of coins he receives in change is minimized. Help him to determine what this minimum number is.FJ wants to buy *T* (1 ≤ *T* ≤ 10,000) cents of supplies. The currency system has *N* (1 ≤ *N* ≤ 100) different coins, with values *V*_{1}, *V*_{2}, ..., *V*_{N} (1 ≤ *V*_{i} ≤ 120). Farmer John is carrying *C*_{1} coins of value *V*_{1}, *C*_{2} coins of value *V*_{2}, ...., and *C*_{N} coins of value *V*_{N} (0 ≤ *C*_{i} ≤ 10,000). The shopkeeper has an unlimited supply of all the coins, and always makes change in the most efficient manner (although Farmer John must be sure to pay in a way that makes it possible to make the correct change).

Line 1: Two space-separated integers: *N* and *T*.
Line 2: N space-separated integers, respectively *V*_{1}, *V*_{2}, ..., *V*_{N} coins (*V*_{1}, ...*V*_{N})
Line 3: N space-separated integers, respectively *C*_{1}, *C*_{2}, ..., *C*_{N}

Line 1: A line containing a single integer, the minimum number of coins involved in a payment and change-making. If it is impossible for Farmer John to pay and receive exact change, output -1.

提交代码