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

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

[<EntryPoint>]
let main _ =
    let nk = reads int
    let ps = reads int
    match nk with
    | [|n; k|] ->
        [|0..n - k|]
        |> Array.Parallel.map (fun x -> split2 x k ps)
        |> Set.ofArray
        |> Set.count
        |> printfn "%d"
    | _ -> exit(1)

    0
