let reads f = stdin.ReadLine().Split(' ') |> Array.map f

let [|n; k|] = reads int
let ps = reads int
 
let split2 left front array =
    array
    |> Array.splitAt left
    |> (fun (l,r) ->
        let (f,r) = Array.splitAt front r
        Array.concat [|l; Array.sort f; r|]
    )

[|0..n - k|]
|> Array.map (fun x -> split2 x k ps)
|> Array.distinct
|> Array.length
|> printfn "%d"
