n, k = map(int, input().split()) d = list(map(int, input().split())) memo = {} for i in range(n): memo[d[i]] = i ans = 0 for i in range(n): if memo[i + 1] != i: memo[d[i]] = memo[i + 1] memo[i + 1] = i ans += 1 if ans <= k and (k - ans) % 2 == 0: print("YES") else: print("NO")