#include using namespace std; #define rep(i,n) for (int i=0;i<(n);i++) #define rep2(i,a,b) for (int i=(a);i<(b);i++) #define rrep(i,n) for (int i=(n)-1;i>=0;i--) #define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--) #define all(a) (a).begin(),(a).end() #define ifnot(x) if(not(x)) #define dump(x) cerr << #x << " = " << (x) << endl; typedef long long ll; typedef unsigned long long ull; typedef pair P; int N; ll K; int D[200001]; int cnt; void solve() { cin >> N >> K; rep(i, N) { cin >> D[i + 1]; } rep2(i, 1, N+1) { int t; t = D[i]; D[i] = 0; while(D[t]) { int temp = t; t = D[t]; D[temp] = 0; cnt++; } } dump(cnt); cout << (K >= cnt && ((K - cnt) % 2 == 0) ? "YES" : "NO") << endl; } int main() { solve(); return 0; }