#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; signed main(){ int n, k; cin >> n >> k; vector d(n); int cnt = 0; int cnt2 = 0; rep(i, 0, n){ cin >> d[i]; } rep(i, 0, n){ if(d[i] != i + 1){ swap(d[d[i] - 1], d[i]); cnt++; } } // cout << cnt << cnt2 << 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; }