#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; const double EPS = 1e-9; typedef vector vint; typedef pair pint; #define rep(i, n) REP(i, 0, n) #define ALL(v) v.begin(), v.end() #define MSG(a) cout << #a << " " << a << endl; #define REP(i, x, n) for(int i = x; i < n; i++) template void chmax(T& a, C b){ a>b?:a=b; } template void chmin(T& a, C b){ a> N >> K; for(int i = 0; i < N; i++){ cin >> d[i]; } for(int i = 0; i < N; i++){ if(d[i] == i+1){ }else{ res++; //cout << d[i] << " " << d[d[i]-1] << endl; if(d[d[i]-1] == i+1 && d[d[i]-1] < d[i]){ res--; } //cout << res << endl; } } if(min(res,N-1) <= K && (K - min(res,N-1)) % 2 == 0){ cout << "YES" << endl; }else{ cout << "NO" << endl; } }