# -*- coding: utf-8 -*- """ No.482 あなたの名は https://yukicoder.me/problems/no/482 """ import sys from sys import stdin input = stdin.readline def solve(N, K, D): num2pos = dict() # 数字がリストのどこにあるか検索するための辞書 D.insert(0, 0) for i, d in enumerate(D): num2pos[d] = i for i in range(1, N+1): if D[i] != i: K -= 1 # 能力を1回使って魂を入れ替え t = num2pos[i] num2pos[t] = D[i] D[t] = D[i] # D[i] = i # num2pos[i] = i if K < 0 or K % 2 != 0: return 'NO' return 'YES' def main(args): N, K = map(int, input().split()) D = [int(x) for x in input().split()] ans = solve(N, K, D) print(ans) if __name__ == '__main__': main(sys.argv[1:])