#include "iostream" #include "climits" #include "list" #include "queue" #include "stack" #include "set" #include "functional" #include "algorithm" #include "math.h" #include "utility" #include "map" using namespace std; const long long int MOD = 1000000007; int N; long long int K; int num[200001]; bool flag[200001]; int t; queue Q; int main() { cin >> N >> K; for (int i = 1; i <= N; i++) { flag[i] = true; cin >> num[i]; } for (int i = 1; i <= N; i++) { if (flag[i]) { t++; Q.push(i); flag[i] = false; } while (!Q.empty()) { if (flag[num[Q.front()]]) { Q.push(num[Q.front()]); } Q.pop(); } } if ((N - t) % 2 == K % 2) { cout << "YES\n"; } else { cout << "NO\n"; } return 0; }