Codeforces Round 444 (Div. 2)
F
Row of Models
Codeforces
2500
原题
← E→
翻译中…

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.

翻译中…

Input

翻译中…

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.

翻译中…

Output

翻译中…

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

翻译中…

样例

Input #1
5 4
2 3 5 2 5
Output #1
NO
InputCopy OutputCopy
Input #2
5 2
3 6 2 2 1
Output #2
YES
InputCopy OutputCopy
Input #3
5 2
5 3 6 5 2
Output #3
YES
InputCopy OutputCopy
题目信息
题号
887F
时间限制
2 s
内存限制
512 MB
标签
贪心
排序

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。