#### Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

## Problem Description

Aoki has a shuffled deck of cards which is a permutation of *1* to *N*. He wants to show off an impressive trick to his friends - dealing many cards in decreasing order!

However, Aoki only skilled enough to deal one of the top *K* cards of the deck. What is the longest sequence of cards of decreasing number he can deal?

## Input

The first line of input will contain two integers, *N* and *K*.

The next line contain *N* integers, which respresent the deck. The first integer is the card that is on the top of the deck. Each number is between *1* to *N* inclusive, and no two numbers are the same.

## Output

The output should contain one integer, the maximum number of cards Aoki can deal.

## Limits

For all subtasks: 1 ≤ K ≤ N ≤ 500 000.

Subtask 1 (30%): K = 2.

Subtask 2 (70%): No additional constraints.

Subtask 3 (0%): Sample.

## Sample Input

6 2 2 5 4 1 6 3

## Sample Output

4

## Explanation

He can deal the cards 5, 4, 2, 1 in this order. After this, there is no card smaller than 1, so it's impossible.

### Tags

### Subtasks and Limits

Subtask | Score | #TC | Time | Memory | Scoring |
---|---|---|---|---|---|

1 | 30 | 10 | 1s | 256MB | Minimum |

2 | 70 | 20 | 1s | 256MB | Minimum |

3 | 0 | 1 | 1s | 256MB | Minimum |

### Judge Compile Command

g++-8 ans.cpp -o cardtrick -Wall -Wshadow -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512