最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(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ó)家法律
宣武区| 苗栗县| 宝应县| 同德县| 镇巴县| 江口县| 孟津县| 彭泽县| 诸暨市| 伽师县| 高州市| 克什克腾旗| 恩平市| 霍州市| 乡城县| 遂昌县| 大荔县| 莒南县| 教育| 万年县| 贺兰县| 彭泽县| 淮阳县| 台湾省| 金寨县| 鹤岗市| 南川市| 探索| 石台县| 宜兰县| 公主岭市| 临桂县| 新和县| 富锦市| 清丰县| 宁南县| 富川| 东城区| 台江县| 香格里拉县| 海兴县|