#include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define llong long long int swapping(vector &d) { int cnt = 0; rep(i, d.size()) { if(d[i] == i) continue; while(true) { swap(d[i], d[d[i]]); cnt += 1; if(d[i] == i) break; } } return cnt; } int main() { llong n, k; cin >> n >> k; vector d(n); rep(i, n) { int val; cin >> val; d[i] = val -1; } llong cnt = swapping(d); if(cnt <= k && (k-cnt) % 2 == 0) { cout << "YES\n"; } else { cout << "NO\n"; } }