#include #include using namespace std; using ll = long long; int main() { ll N, K; cin >> N >> K; vector D(N), p(N); for (ll i = 0; i < N; i++) { cin >> D[i]; D[i] -= 1LL; p[D[i]] = i; } for (ll i = 0; i < N; i++) { if (p[i] == i) continue; swap(p[i], p[D[i]]); K -= 1LL; } if (K < 0LL) { cout << "NO" << endl; } else { cout << (K % 2LL == 0LL ? "YES" : "NO") << endl; } return 0; }