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