# 必要最低回数+偶数==KならOKか N, K = map(int, input().split()) D = [0]+list(map(int, input().split())) dic = {} for i in range(N+1): dic[D[i]] = i mn = 0 for i in range(1, N+1): if D[i] != i: correct = dic[i] dic[i] = i dic[D[i]] = correct D[i], D[correct] = D[correct], D[i] mn += 1 #print(mn, D, dic) if K >= mn and (K-mn)%2 == 0: print('YES') else: print('NO')