import java.math.BigInteger; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashSet; import java.util.LinkedList; import java.util.Scanner; import java.util.Set; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); final int N = sc.nextInt(); final long K = sc.nextLong(); int[] swap = new int[N]; for(int i = 0; i < N; i++){ swap[i] = sc.nextInt() - 1; } int[] rev_swap = new int[N]; for(int i = 0; i < N; i++){ rev_swap[swap[i]] = i; } long min_times = 0; for(int i = 0; i < N; i++){ if(swap[i] != i){ final int swap_index = rev_swap[i]; //System.out.println(i + " " + swap[i] + " " + swap_index); rev_swap[swap[i]] = swap_index; rev_swap[i] = i; swap[swap_index] = swap[i]; swap[i] = i; min_times++; } //System.out.println(Arrays.toString(swap)); } if(min_times > K || (K - min_times) % 2 != 0){ System.out.println("NO"); }else{ System.out.println("YES"); } } }