#include<bits/stdc++.h>
 using namespace std;
#define INF 1000000000
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
typedef long long LL;
LL N,K;
int A[300000];
map<int ,int>m;
int swap(int *a,int *b){
    int temp=*a;
    *a=*b;
    *b=temp;
}
int main(){
    cin>>N>>K;
    REP(i,N){
        cin>>A[i];
        m[A[i]]=i;
    }
    REP(i,N){
        if(A[i]!=i+1){
           int b=m[i+1];
           swap(&A[i],&A[b]);
           m[A[i]]=i;
           m[A[b]]=b;
           //cout<<i+1<<" "<<b<<" "<<m[A[i]]<<" "<<m[A[b]]<<endl;
           K--;
        }
    }
    /*
    REP(i,N){
        cout<<A[i]<<endl;
    }
    cout<<K<<endl;
    */
    if(K<0){
          cout<<"NO"<<endl;
    }else{
       if(K%2==0){
          cout<<"YES"<<endl;
       }else{
          cout<<"NO"<<endl;
       }
    }
    return 0;
}