#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++) { while(i != hairetu[i]) { p=hairetu[i]; hairetu[i]=hairetu[p]; hairetu[p]=p; count++; } } if((K-count)%2==0 && K-count >=0) { printf("YES"); } else { printf("NO"); } }