#include #include using lint = long long; void solve() { int n; lint k; std::cin >> n >> k; std::vector xs(n); for (auto& x : xs) { std::cin >> x; --x; } k -= n; std::vector visited(n, false); for (int v = 0; v < n; ++v) { if (visited[v]) continue; ++k; while (!visited[v]) { visited[v] = true; v = xs[v]; } } std::cout << (k < 0 || k % 2 != 0 ? "NO" : "YES") << std::endl; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }