#include #define rep(i, a, n) for(int i = a; i < n; i++) #define repb(i, a, b) for(int i = a; i >= b; i--) #define all(a) a.begin(), a.end() #define o(a) cout << a << endl #define int long long using namespace std; typedef pair P; int cnt = 0; int a[200010]; int partition(int a[], int left, int right){ int i, j, x, tmp; x = a[left]; i = left - 1; j = right + 1; while(1){ do{ j--; }while(a[j] > x); do{ i++; }while(a[i] < x); if(i < j){ tmp = a[i]; a[i] = a[j]; a[j] = tmp; cnt++; }else{ return j; } } } void sorting(int a[], int left, int right){ int mid; if(left < right){ mid = partition(a, left, right); sorting(a, left, mid); sorting(a, mid + 1, right); } return; } signed main(){ int n, k; cin >> n >> k; rep(i, 0, n){ cin >> a[i]; } sorting(a, 0, n - 1); // rep(i, 0, n){ // if(d[i] != i + 1){ // swap(d[d[i] - 1], d[i]); // cnt++; // } // } // cout << cnt << endl; // if(cnt > 0) cnt--; bool f = true; if(cnt > k) f = false; if(cnt < k && (k - cnt) % 2 == 1) f = false; cout << (f ? "YES" : "NO") << endl; }