Dima and Salad

题意翻译

有 $n$ 个水果,每个水果有两个属性:美味值和卡路里值。现在选用若干个(至少 $1$ 个)水果制作一份特殊的沙拉,沙拉的美味值为所选的水果的美味值的和,沙拉的卡路里值为所选水果的卡路里值的和。沙拉的美味值恰好是卡路里值的 $K$ 倍。请计算该沙拉美味值最大为多少。 **【输入格式】** 第一行,两个整数 $n, k$($1 \le n \le 100$,$1 \le k \le 10$); 第二行,包含 $n$ 个整数 $a_1, a_2, \ldots, a_n$($1 \le a_i \le 100$),表示水果的美味值; 第三行,包含 $n$ 个整数 $b_1, b_2, \ldots, b_n$($1 \le b_i \le 100$),表示水果的卡路里值。 **【输出格式】** 共一行,一个整数,表示最大美味值,若无解则输出 `-1`。

题目描述

Dima, Inna and Seryozha have gathered in a room. That's right, someone's got to go. To cheer Seryozha up and inspire him to have a walk, Inna decided to cook something. Dima and Seryozha have $ n $ fruits in the fridge. Each fruit has two parameters: the taste and the number of calories. Inna decided to make a fruit salad, so she wants to take some fruits from the fridge for it. Inna follows a certain principle as she chooses the fruits: the total taste to the total calories ratio of the chosen fruits must equal $ k $ . In other words, ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF366C/f07d6e1f143f8d1fae686d3a2981d314f5a5105a.png) , where $ a_{j} $ is the taste of the $ j $ -th chosen fruit and $ b_{j} $ is its calories. Inna hasn't chosen the fruits yet, she is thinking: what is the maximum taste of the chosen fruits if she strictly follows her principle? Help Inna solve this culinary problem — now the happiness of a young couple is in your hands! Inna loves Dima very much so she wants to make the salad from at least one fruit.

输入输出格式

输入格式


The first line of the input contains two integers $ n $ , $ k $ $ (1<=n<=100,1<=k<=10) $ . The second line of the input contains $ n $ integers $ a_{1},a_{2},...,a_{n} $ $ (1<=a_{i}<=100) $ — the fruits' tastes. The third line of the input contains $ n $ integers $ b_{1},b_{2},...,b_{n} $ $ (1<=b_{i}<=100) $ — the fruits' calories. Fruit number $ i $ has taste $ a_{i} $ and calories $ b_{i} $ .

输出格式


If there is no way Inna can choose the fruits for the salad, print in the single line number -1. Otherwise, print a single integer — the maximum possible sum of the taste values of the chosen fruits.

输入输出样例

输入样例 #1

3 2
10 8 1
2 7 1

输出样例 #1

18

输入样例 #2

5 3
4 4 4 4 4
2 2 2 2 2

输出样例 #2

-1

说明

In the first test sample we can get the total taste of the fruits equal to 18 if we choose fruit number 1 and fruit number 2, then the total calories will equal 9. The condition ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF366C/ce55a230ecc0a3ebd10e969b3c18a14fbf3f32d3.png) fulfills, that's exactly what Inna wants. In the second test sample we cannot choose the fruits so as to follow Inna's principle.