#include using namespace std; int main(void){ long long int N ,K ; cin >> N >> K ; long long int a[N+1] ; bool used[N+1] ; for(int i=1;i<=N;i++){ cin >> a[i] ; used[i] = false ; } int count = 0 ; for(int i=1;i<=N;i++){ if(!used[i] && i != a[i]){ used[i] = true ; int t = a[i] ; int s = a[t] ; used[t] = true ; while(t != i){ count++ ; t = s ; s = a[t] ; used[t] = true ; } } } if(count<=K && (K-count)%2 == 0){ cout << "YES" << endl ; }else{ cout << "NO" << endl ; } }