#include int main(void){ unsigned long long int n,k,d[262144],i,m,c=0; scanf("%llu%llu",&n,&k); for(i = 1;i <= n;i++){ scanf("%llu",&m);d[i] = m; } for(i = 1;i <= n;i++){ while(i != d[i]){m = d[i];d[i] = d[m];d[m] = m;c++;} } if(k >= c && k-c != 1){printf("YES\n");}else{printf("NO\n");} return 0; }