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; } long min_times = 0; for(int i = 0; i < N; i++){ if(swap[i] != i){ final int tmp = swap[swap[i]]; swap[swap[i]] = swap[i]; swap[i] = tmp; 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"); } } }