P23643 [AtCoder] Balloons
普及+
题目描述

Problem Description

In a competitive programming practice event, balloons are distributed to participants who solve problems during the contest. The organizing team has a clairvoyant who knows that a total of $M$ balloons are needed.

Currently, there are $N$ colors of balloons available, with $a_i$ balloons of color $i$ ($=1, 2, \ldots, N$). From these, we need to select a total of $M$ balloons. We want to minimize the number of different colors appearing in the selected balloons. Write a program to find the minimum number of different colors.

Input Format

The input is given from the standard input in the following format:

$N$ $M$ $a_1$ $a_2$ $\ldots$ $a_N$

Output Format

Output the answer in one line.

Sample Input and Output

Sample Input #1

5 17
4 5 7 9 2

Sample Output #1

3

Sample Input #2

2 9
3 6

Sample Output #2

2

Sample Input #3

10 9
1 2 3 4 5 6 7 8 9 10

Sample Output #3

1

Sample Input #4

10 129
12 42 13 25 32 19 14 9 21 12

Sample Output #4

5

Notes/Hints

Constraints

  • $1 \le N \le 10^5$
  • $1 \le M \le 10^9$
  • $1 \le a_i \le 10^9$
  • $a_1 + a_2 + \dots + a_N \ge M$
  • All given inputs are integers.

Sample Explanation 1

For example, using 4 balloons of color $1$, 6 balloons of color $3$, and 7 balloons of color $4$, we can prepare 17 balloons with just 3 different colors.

Sample Explanation 2

It is possible to use exactly all the available balloons.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
5 17 4 5 7 9 2
样例输出
3