import java.util.Scanner; public class YourName { public static void main(String[] args) { Scanner s = new Scanner(System.in); int N = s.nextInt(); int rest = N; long K = s.nextLong(); int[] D = new int[N]; for(int i = 0;i < N;i++){ D[i] = s.nextInt(); if(i+1 == D[i]){ D[i] = 0; rest--; } } s.close(); for(int i = 0;i < rest;i++){ if(D[i] != 0){ while(D[i] != i+1){ //System.out.println("D[" + i + "] = " + D[i]); int k = D[D[i]-1]; D[D[i]-1] = 0; rest--; D[i] = k; K--; } if(K < 0){ break; } } } if(K % 2 == 0){ System.out.println("YES"); }else{ System.out.println("NO"); } } }