The Great Kagura loves the number S
. In front of her, she has a sequence of integers . She wants to select a collection of these integers such that the sum of the absolute values of the differences of all pairs of integers in her collection is at most S
. For example, if her collection is x, y, z
, then |x − y| + |x − z| + |y − z| ≤ S
. She wants to select the largest collection that she can. Can you help her?
Input Data
The first line of the input contains the two integers n
and S
. The second line of the input contains .
Output Data
Output the size of the largest collection of integers from among that satisfy the required condition.
Restrictions
1 ≤ n ≤ 300 000
Subtask 1 (6 points)
Subtask 2 (7 points)
Subtask 3 (8 points)
Subtask 4 (9 points)
n ≤ 20
S ≤ 1 000 000 000
Subtask 5 (21 points)
n ≤ 100
S ≤ 1 000 000 000
Subtask 6 (18 points)
n ≤ 2000
S ≤ 1 000 000 000
Subtask 7 (31 points)
- No further restrictions.
Examples
stdin
5 3
1 2 3 4 5
stdout
2
Explanation
One possible collection is 1, 2
. All collections with 3
elements have the sum of absolute differences at least 4
.
stdin
5 4
1 2 3 4 5
stdout
3
Explanation
One possible collection is 1, 2, 3
.
stdin
5 1
1 1 1 1 1
stdout
5
Explanation
The entire sequence is a valid collection.
stdin
10 7
1 5 3 2 4 3 1 3 2 100
stdout
5
Explanation
One possible collection is 2, 2, 3, 3, 3
.