#include "bits/stdc++.h" #define REP(i,n,N) for(ll i=(n); i<(N); i++) #define RREP(i,n,N) for(ll i=(N-1); i>=n; i--) #define CK(n,a,b) ((a)<=(n)&&(n)<(b)) #define ALL(v) (v).begin(),(v).end() #define p(s) cout<<(s)<>N>>K; REP(i,0,N){ cin>>D[i]; D[i]--; edge[i]=D[i]; } REP(i,0,N){ ll now=i; if(ok[now]) continue; while(!ok[now]){ cnt++; ok[now]=true; now=edge[now]; } cnt--; } if(cnt%2==K%2&&cnt<=K){ p("YES"); }else{ p("NO"); } return 0; }