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