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[] arr = new int[n + 1]; for (int i = 1; i <= n; i++) { arr[i] = sc.nextInt(); } for (int i = 1; i <= n; i++) { while (arr[i] != i) { int idx = arr[i]; arr[i] = arr[idx]; arr[idx] = idx; k--; } } if (k >= 0 && k % 2 == 0) { System.out.println("YES"); } else { System.out.println("NO"); } } }