n, k = [int(i) for i in input().split()] d = [int(i) for i in input().split()] def sort(d, k): cnt = 0 for i in range(len(d)): if d[i] == i + 1: continue for j in range(i, len(d)): if d[j] == i + 1: d[i], d[j] = d[j], d[i] cnt += 1 break if cnt > k: return False return (k - cnt) % 2 == 0 if sort(d, k): print('YES') else: print('NO')