import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); long K = scan.nextInt(); int[]D1 = new int[N + 1]; int[]D2 = new int[N + 1]; for(int i = 0; i < N; i++) { //D[i] = scan.nextInt(); int t = scan.nextInt(); D1[i + 1] = t; D2[t] = i + 1; } scan.close(); long cnt = 0; for(int i = 1; i <= N; i++) { if(D1[i] != i) { int t1 = D1[i]; int t2 = D2[i]; D1[i] = i; D2[i] = i; D1[t2] = t1; D2[t1] = t1; cnt++; } } if(cnt > K) { System.out.println("NO"); }else { long t = K - cnt; if(t % 2 == 0) { System.out.println("YES"); }else { System.out.println("NO"); } } } }