n, k = [int(i) for i in input().split()] d = [int(i) for i in input().split()] def count(d): cnt = 0 for i in range(len(d)): if d[i] == i + 1: cnt += 1 return cnt cnt = count(d) rcnt = count(list(reversed(d))) l = len(d) tmp = 0 if cnt == l or rcnt == l: tmp = len(d) // 2 else: tmp = len(d) - 1 - cnt if (k - tmp) % 2 == 0: print('YES') else: print('NO')