#include using namespace std; #define ALL(x) x.begin(),x.end() #define rep(i,n) for(int i=0;i<(n);i++) #define debug(v) cout<<#v<<":";for(auto x:v){cout<bool chmax(T &a,const T &b){if(abool chmin(T &a,const T &b){if(b ostream &operator<<(ostream &os,const pair&p){ os< ostream &operator<<(ostream &os,const vector&v){ for(int i=0;i<(int)v.size();i++) os<> cycle_partition(const vector &p){ int n=p.size(); vector> ret; vector check(n,false); rep(i,n)if(!check[p[i]]){ vector v; int pos=p[i]; v.push_back(i); check[i]=true; while(pos!=i){ v.push_back(pos); check[pos]=true; pos=p[pos]; } ret.push_back(v); } return ret; } signed main(){ int n;ll k;cin>>n>>k; vector d(n); rep(i,n){ cin>>d[i];d[i]--; } auto g=cycle_partition(d); rep(i,g.size())k-=(int)g[i].size()-1; if(k%2==0 and k>=0) cout<<"YES"<