无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

CF 609A - USB Flash Drives

2023-07-06 12:02 作者:您是打尖兒還是住店呢  | 我要投稿

Sean is trying to save a large file to a USB flash drive. He has?n?USB flash drives with capacities equal to?a1,?a2,?...,?an?megabytes. The file size is equal to?m?megabytes.

Find the minimum number of USB flash drives needed to write Sean's file, if he can split the file between drives.

Input

The first line contains positive integer?n?(1?≤?n?≤?100) — the number of USB flash drives.

The second line contains positive integer?m?(1?≤?m?≤?105) — the size of Sean's file.

Each of the next?n?lines contains positive integer?ai?(1?≤?ai?≤?1000) — the sizes of USB flash drives in megabytes.

It is guaranteed that the answer exists, i. e. the sum of all?ai?is not less than?m.

Output

Print the minimum number of USB flash drives to write Sean's file, if he can split the file between drives.

Examples

input

3
5
2
1
3

output

2

input

3

6
2
3
2

output

3

input

2

5
5
10

output

1

Note

In the first example Sean needs only two USB flash drives — the first and the third.

In the second example Sean needs all three USB flash drives.

In the third example Sean needs only one USB flash drive and he can use any available USB flash drive — the first or the second.

-----------------------------

因?yàn)槭钦易钚〉腢SB數(shù)量,所以對(duì)USB的容量要從大到小去遍歷,每次存儲(chǔ)余量大小,≤0 的時(shí)候,退出循環(huán),記錄當(dāng)前用了多少個(gè)USB,輸出即可;

下面是代碼:


CF 609A - USB Flash Drives的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
娱乐| 永年县| 沙坪坝区| 海门市| 肇源县| 南宁市| 洞口县| 杂多县| 成武县| 江门市| 行唐县| 绍兴市| 泸西县| 法库县| 桂东县| 东乌| 大港区| 宁强县| 昆山市| 沈阳市| 达拉特旗| 仙居县| 四川省| 卢湾区| 浑源县| 嘉义市| 都兰县| 甘洛县| 滨海县| 名山县| 澄迈县| 乾安县| 巴楚县| 淄博市| 都兰县| 阿克陶县| 米脂县| 山东省| 精河县| 新干县| 大姚县|