#P41B. Martian Dollar

Martian Dollar

Martian Dollar

题面翻译

一天小V得到了接下来n天,在篮球星有火星元的交易的信息。

第i天每一火星元的市价(不管是买入还是卖出都一样)是a[i]信用点, 小V有b 信用点。

小V最多可以买一次火星元,也只能卖一次火星元​。

根据篮球星法律,对火星元的买卖必须以整数为单位。

试问小V在过了n天后最多能得到多少信用点?

输入格式: 第一行两个数n,b(1<=n,b<=2000)n,b (1 <= n,b <= 2000) , 第二行,n个数a[i] 1<=ai<=2000 1 <= a_i<= 2000 ,含义如题 输出格式: 一行一个数,表示答案。

Translated by @Maniac丶坚果

题目描述

One day Vasya got hold of information on the Martian dollar course in bourles for the next n n days. The buying prices and the selling prices for one dollar on day i i are the same and are equal to ai a_{i} . Vasya has b b bourles. He can buy a certain number of dollars and then sell it no more than once in n n days. According to Martian laws, one can buy only an integer number of dollars. Which maximal sum of money in bourles can Vasya get by the end of day n n ?

输入格式

The first line contains two integers n n and b b ( 1<=n,b<=2000 1<=n,b<=2000 ) — the number of days and the initial number of money in bourles. The next line contains n n integers ai a_{i} ( 1<=ai<=2000 1<=a_{i}<=2000 ) — the prices of Martian dollars.

输出格式

Print the single number — which maximal sum of money in bourles can Vasya get by the end of day n n .

样例 #1

样例输入 #1

2 4
3 7

样例输出 #1

8

样例 #2

样例输入 #2

4 10
4 3 2 1

样例输出 #2

10

样例 #3

样例输入 #3

4 10
4 2 3 1

样例输出 #3

15