QOJ.ac

QOJ

Limite de temps : 3 s Limite de mémoire : 128 MB Points totaux : 100

#14470. Uncle Fang's Cornfield

Statistiques

Uncle Fang is walking along the edge of his farmland when he suddenly notices that a row of corn in the field is very unsightly.

There are $n$ corn plants in this row, and their heights are uneven.

Uncle Fang believes that a non-decreasing sequence is beautiful, so he decides to first increase the height of some corn plants, and then remove the corn plants that spoil the beauty, so that the heights of the remaining corn plants form a non-decreasing sequence.

Uncle Fang can choose an interval and increase the height of all corn plants in this interval by 1 unit. He can perform this operation at most $K$ times.

As for removing corn, he can choose any set of corn plants to remove.

What is the maximum number of corn plants that can remain to form a beautiful row of corn?

Input

The first line contains two integers $n$ and $K$, representing the number of corn plants in the row and the maximum number of operations that can be performed, respectively.

The second line contains $n$ integers, where the $i$-th integer represents the height $a_i$ of the $i$-th corn plant from left to right.

Output

Output a single integer, the maximum number of remaining corn plants.

Examples

Input 1

3 1
2 1 3

Output 1

3

Constraints

For 10% of the data, $1 \le n \le 1000, 1 \le K \le 100$

For 100% of the data, $1 \le n \le 10000, 1 \le K \le 500, 1 \le a_i \le 5000$

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.