#!/usr/bin/env pypy3 import sys REC_LIMIT = 10000 # http://www.prefield.com/algorithm/sort/mergecount.html def inversion_number(xs): n = len(xs) cnt = 0 if n > 1: bs = xs[:n // 2] cs = xs[n // 2:] cnt += inversion_number(bs) cnt += inversion_number(cs) j = 0 k = 0 for i in range(n): if k == len(cs): xs[i] = bs[j] j += 1 elif j == len(bs): xs[i] = cs[k] k += 1 elif bs[j] <= cs[k]: xs[i] = bs[j] j += 1 else: xs[i] = cs[k] k += 1 cnt += n // 2 - j return cnt def judge(n, k, ds): inv_n = inversion_number(ds) return inv_n <= k and (inv_n + k) % 2 == 0 def main(): sys.setrecursionlimit(REC_LIMIT) n, k = (int(x) for x in input().split()) ds = [int(x) for x in input().split()] print("YES" if judge(n, k, ds) else "NO") if __name__ == '__main__': main()