#include using namespace std; #ifdef LOCAL_DEBUG #include "LOCAL_DEBUG.hpp" #endif #define int long long signed main(){ int n, k; cin >> n >> k; vector d(n); for(int i = 0; i < n; i++){ cin >> d[i]; d[i]--; } int ans = 0; for(int i = 0; i < n; i++){ while(d[i] != i){ swap(d[i], d[d[i]]); ans++; } } if(ans <= k && ans % 2 == k % 2){ cout << "YES" << endl; }else{ cout << "NO" << endl; } return 0; }