#ABC478C. 排序子数组 / Sort Subarray

排序子数组 / Sort Subarray

Problem Statement

You are given a length-NN integer sequence A=(A1,A2,…,AN)A=(A_1,A_2,\ldots,A_N).

You will perform the following operation on AA exactly once.

  • Choose an integer ii between 11 and N−K+1N-K+1, inclusive. Sort Ai,Ai+1,…,Ai+K−1A_i,A_{i+1},\ldots,A_{i+K-1} in ascending order. More formally, let B1,B2,…,BKB_1,B_2,\ldots,B_K be Ai,Ai+1,…,Ai+K−1A_i,A_{i+1},\ldots,A_{i+K-1} arranged in increasing order, and simultaneously replace Ai+j−1A_{i+j-1} with BjB_j for 1≤j≤K1\le j\le K.

Determine whether it is possible that, after this operation, AA is in ascending order, that is, Ai≤Ai+1A_i\le A_{i+1} holds for all 1≤i<N1\le i\lt N.

Constraints

  • 1≤K<N≤2×1051\le K\lt N\le2\times10^5
  • 1≤Ai≤N (1≤i≤N)1\le A_i\le N\ (1\le i\le N)
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

  • NN KK
  • A1A_1 A2A_2 …\ldots ANA_N

Output

If AA can be sorted in ascending order by performing the operation once, output Yes; otherwise, output No.

9 6
1 4 1 4 2 1 3 5 6
Yes

For example, if you choose 22 as ii, then (A2,A3,A4,A5,A6,A7)=(4,1,4,2,1,3)(A_2,A_3,A_4,A_5,A_6,A_7)=(4,1,4,2,1,3) is replaced with (1,1,2,3,4,4)(1,1,2,3,4,4). After the operation, AA is (1,1,1,2,3,4,4,5,6)(1,1,1,2,3,4,4,5,6), which satisfies the condition.

Thus, output Yes.

3 1
3 2 1
No

K=1K=1, so AA does not change regardless of which ii the operation is performed on. Thus, output No.

30 25
1 2 2 22 14 10 14 10 18 5 15 8 17 22 10 17 11 25 13 16 9 19 26 7 11 12 23 3 30 30
Yes