import sys import pypyjit import itertools import heapq import math from collections import deque, defaultdict import bisect input = sys.stdin.readline sys.setrecursionlimit(10 ** 6) pypyjit.set_param('max_unroll_recursion=-1') def index_lt(a, x): 'return largest index s.t. A[i] < x or -1 if it does not exist' return bisect.bisect_left(a, x) - 1 def index_le(a, x): 'return largest index s.t. A[i] <= x or -1 if it does not exist' return bisect.bisect_right(a, x) - 1 def index_gt(a, x): 'return smallest index s.t. A[i] > x or len(a) if it does not exist' return bisect.bisect_right(a, x) def index_ge(a, x): 'return smallest index s.t. A[i] >= x or len(a) if it does not exist' return bisect.bisect_left(a, x) N, K = map(int, input().split()) D = list(map(int, input().split())) idx = {} for i in range(N): idx[D[i]] = i cnt = 0 for i in range(N): if D[i] == i + 1: continue j = idx[i + 1] s, t = D[i], D[j] D[i], D[j] = D[j], D[i] idx[s], idx[t] = idx[t], idx[s] cnt += 1 print('YES' if cnt <= K and (K - cnt) % 2 == 0 else 'NO')