#include int main(void){ long long int N,K,i,count,k,p; scanf("%lld",&N); scanf("%lld",&K); long long int hairetu[N]; for(i=1;i<=N;i++) { scanf("%lld",&hairetu[i]); } count=0; for(i=1;i<=N;i++) { if(i ==! hairetu[i]) { p=hairetu[i]; while(i == !hairetu[p]) { k=hairetu[p]; hairetu[p]=p; if(p ==! i) {p=k;} else {p=1;} count++; } } } if((K-count)%2==0 && K-count>=0) { printf("YES"); } else { printf("NO"); } }