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

let splitSort 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|] ->
        Array.init (n - k) id
        |> Array.Parallel.map (fun x -> splitSort x k ps)
        |> Set.ofArray
        |> Set.count
        |> printfn "%d"
    | _ -> exit(1)

    0
