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