import java.util.ArrayList; import java.util.Scanner; public class YourName { static ArrayList list = new ArrayList<>(); static StringBuilder cut = new StringBuilder(); static long K; static int N; public static void main(String[] args) { Scanner s = new Scanner(System.in); N = s.nextInt(); K = s.nextLong(); list.add(0); cut.append('0'); for(int i = 1;i<=N;i++){ list.add(s.nextInt()); cut.append('1'); } s.close(); for(int i = 1;i<=N;){ swtch(i); if(cut.indexOf("1") == -1){ break; }else{ i = cut.indexOf("1"); } } if(K > 0&&K%2 == 0){ K = 0; } if(K == 0) System.out.println("YES"); else System.out.println("NO"); } static void swtch(int i){ if(i != list.get(i)){ int t = list.indexOf(i); list.set(t, list.get(i)); list.set(i, i); cut.setCharAt(i, '0'); swtch(t); K--; }else{ cut.setCharAt(i, '0'); } } }