#include "bits/stdc++.h" using namespace std; #ifdef _DEBUG #include "dump.hpp" #else #define dump(...) #endif //#define int long long #define rep(i,a,b) for(int i=(a);i<(b);i++) #define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--) #define all(c) begin(c),end(c) const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f; const int MOD = 1'000'000'007; template bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; } // 転倒数(inversion number) // O(n log n) // a[i] > a[j] かつ i < j である組の数 // // Verified: // http://arc075.contest.atcoder.jp/submissions/1481787 template long long merge(It l, It m, It r) { long long cnt = 0; vector tmp(r - l); It it = tmp.begin(), it1 = l, it2 = m; while (it1 != m && it2 != r) { if (*it1 < *it2) *it++ = *it1++; else *it++ = *it2++, cnt += m - it1; } while (it1 != m) *it++ = *it1++; while (it2 != r) *it++ = *it2++; move(tmp.begin(), tmp.end(), l); return cnt; }; template long long mergeSort(It l, It r) { if (r - l <= 1)return 0; long long cnt = 0; It m = l + (r - l) / 2; cnt += mergeSort(l, m); cnt += mergeSort(m, r); cnt += merge(l, m, r); return cnt; } signed main() { cin.tie(0); ios::sync_with_stdio(false); int N, K; cin >> N >> K; vector D(N); rep(i, 0, N) { cin >> D[i]; } long long inv = mergeSort(all(D)); if(K % 2 == inv % 2) cout << "YES" << endl; else cout << "NO" << endl; return 0; }