Row of Models

题意翻译

Izabella 有一个长度为 $n$ 的整数序列 $a$。还有一个整数 $k$。 定义 $p_i$ 为最小的整数 $x$ 满足 $a_x<a_i,x\in[i+1,n]$。如果找不到 $x$,$p_i=n+1$。 Izabella 认为这个序列是美丽的,当且仅当对于每一个 $1\le i\le n$,满足 $p_i-i\le k$。 她有一次交换序列中任意两个数 $a_x,a_y$ 的机会,但是要保证 $x<y$ 并且 $a_x>a_y$。 请你告诉她,她是否可以将序列变成美丽的。 $1\le k\le n\le 5\times 10^5,1\le a_i\le 10^9$

题目描述

During the final part of fashion show all models come to the stage and stay in one row and fashion designer stays to right to model on the right. During the rehearsal, Izabella noticed, that row isn't nice, but she can't figure out how to fix it. Like many other creative people, Izabella has a specific sense of beauty. Evaluating beauty of row of models Izabella looks at heights of models. She thinks that row is nice if for each model distance to nearest model with less height (model or fashion designer) to the right of her doesn't exceed $ k $ (distance between adjacent people equals 1, the distance between people with exactly one man between them equals 2, etc). She wants to make row nice, but fashion designer has his own sense of beauty, so she can at most one time select two models from the row and swap their positions if the left model from this pair is higher than the right model from this pair. Fashion designer (man to the right of rightmost model) has less height than all models and can't be selected for exchange. You should tell if it's possible to make at most one exchange in such a way that row becomes nice for Izabella.

输入输出格式

输入格式


In first line there are two integers $ n $ and $ k $ ( $ 1<=n<=5·10^{5} $ , $ 1<=k<=n $ ) — number of models and required distance. Second line contains $ n $ space-separated integers $ a_{i} $ ( $ 1<=a_{i}<=10^{9} $ ) — height of each model. Pay attention that height of fashion designer is not given and can be less than 1.

输出格式


Print «YES» (without quotes) if it's possible to make row nice using at most one exchange, and «NO» (without quotes) otherwise.

输入输出样例

输入样例 #1

5 4
2 3 5 2 5

输出样例 #1

NO

输入样例 #2

5 2
3 6 2 2 1

输出样例 #2

YES

输入样例 #3

5 2
5 3 6 5 2

输出样例 #3

YES