n, k = map(int, input().split()) a = [0] + list(map(int, input().split())) x = 0 for i in range(1, n + 1): while a[i] != i: t = a[i] a[i], a[t] = a[t], a[i] x += 1 if x <= k and x % 2 == k % 2: print("YES") else: print("NO")