This page is still under construction.

Parts of this page are still being built. What you see may change.

Concert

Time limit1sMemory limit1024 MB

Summary
Give K spectators a +1 height boost so that the maximum number of people stand strictly taller than everyone in front of them.
Level

Medium6 of 10

Topics
Dynamic programming, Greedy
Solved
No attempts yet

Problem

In Bitland, the long-awaited concert of the famous local band Bitlai is about to begin. NN spectators have gathered to watch it, and the hall is arranged so that they stand in a single line, one directly behind another: spectator 11 stands right at the stage, spectator 22 stands behind spectator 11, spectator 33 behind spectator 22, and so on. The spectator at position ii has height uiu_i (Bitland meters). A spectator can see the stage only if every spectator standing in front of them is strictly shorter.

The organizers did not plan for this and have only KK chairs to hand out, each exactly 11 Bitland meter tall. A chair can hold only one spectator, and each spectator may receive at most one chair. When a spectator stands on a chair, their height increases by 11 Bitland meter. As a result that spectator may become able to see the stage, but they may also block the view of the spectators standing behind them.

Find the maximum number of spectators who can see the stage if the chairs are distributed optimally.

Input

The first line contains two space-separated integers: the number of spectators NN and the number of chairs KK.

The second line contains NN space-separated integers uiu_i — the heights of the spectators in the order they stand in the hall.

Output

Print a single integer — the maximum number of spectators who can see the concert when the chairs are distributed optimally.

Constraints

  • 1≤K≤N≤1000001 \le K \le N \le 100000
  • 1≤ui≤10000001 \le u_i \le 1000000 (1≤i≤N1 \le i \le N)

Examples1

  1. Example 1

    Input
    5 3
    3 2 3 2 5
    
    Expected output
    3