#D11659. Cyclic Shift Sort
Cyclic Shift Sort
Cyclic Shift Sort
Problem
Given a permutation of length and the integer . Determine if the permutation can be monotonically increased by repeating the following operation any number of times or more.
- Choose the integer . Patrol right shift around
However, the cyclic right shift of the subsequence means that is changed to . Means to change.
Constraints
The input satisfies the following conditions.
- All inputs are integers
Input
The input is given in the following format.
Permutation length and integer are given in the first row, separated by blanks. The elements of the permutation are given in the second row, separated by blanks.
Output
Print "Yes" if you can monotonically increase , otherwise print "No" on the line.
Examples
Input
3 3 2 3 1
Output
Yes
Input
3 2 1 2 3
Output
Yes
Input
3 3 3 2 1
Output
No
inputFormat
input satisfies the following conditions.
- All inputs are integers
Input
The input is given in the following format.
Permutation length and integer are given in the first row, separated by blanks. The elements of the permutation are given in the second row, separated by blanks.
outputFormat
Output
Print "Yes" if you can monotonically increase , otherwise print "No" on the line.
Examples
Input
3 3 2 3 1
Output
Yes
Input
3 2 1 2 3
Output
Yes
Input
3 3 3 2 1
Output
No
样例
3 2
1 2 3
Yes