let stepCountToSort (arr:int[]) = let cnt = ref 0 let swap a b = let t = arr.[a] arr.[a] <- arr.[b] arr.[b] <- t for i in 1..arr |> Array.length do let idx = i-1 if i <> arr.[idx] then //arr.[idx]が本来あるべき位置 let rightIdx = arr.[idx]-1 swap idx rightIdx incr cnt cnt.Value let N,K = let t = stdin.ReadLine().Split() in t.[0] |> int, t.[1] |> int64 let D = stdin.ReadLine().Split() |> Array.map int D |> stepCountToSort |> int64 |> function | x when x<=K && (K-x)%2L=0L -> "YES" | _ -> "NO" |> printfn "%s"