import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); long K = sc.nextLong(); int[] d = new int[N + 1]; for(int i = 1; i < N + 1; i++) { d[i] = sc.nextInt(); } long num = 0; for(int i = 1; i < N + 1; i++) { while(d[i] != i) { int temp = d[i]; d[i] = d[d[i]]; d[d[i]] = temp; num++; } } String ans = "NO"; if(num <= K && (K - num) % 2 == 0) ans = "YES"; System.out.println(ans); } }