n,k = map(int,input().split(' ')) d = list(map(lambda x:int(x)-1,input().split(' '))) pos = [0] * n for i in range(n): pos[d[i]] = i for i in range(n): if d[i] != i: pos[d[i]] = pos[i] d[i],d[pos[i]] = d[pos[i]],d[i] k -= 1 if k >= 0 and k % 2 == 0: print("YES") else: print("NO")