#include #include #include #include using namespace std; bool A[200000]; int X[200000]; int solve(int i) { int cnt = 0; if (A[X[i] - 1] == false){ A[i] = true; cnt = solve(X[i] - 1) + 1; } return cnt; } int main() { int n, k; cin >> n >> k; for (int i = 0; i < n; i++)cin >> X[i]; int sum = 0; for (int i = 0; i < n; i++) { if (!A[i]) { A[i] = true; sum += solve(i); } } if ((k - sum) % 2 == 0)cout << "YES" << endl; else cout << "NO" << endl; return 0; }