N,K = map(int,input().split()) D = list(map(int,input().split())) cnt = 0 for i in range(N): if D[i] != i + 1: cnt+=1 def check(): if cnt <= 2: return (K - cnt//2) % 2 == 0 else: if cnt % 2 == 0: return (K - cnt // 2) % 2 == 0 else: return (K - (cnt // 2 + 1)) % 2 == 0 if check(): print('YES') else: print('NO')