import sys

from collections import deque



def solve():

    input = sys.stdin.readline

    N, K = list(map(int, input().split()))

    A = [int(a) for a in input().split()]

    l = A.index(1)

    count = 1

    

    r = K - 1

    while r < l:

        r += (K - 1)

        count += 1

    

    if r < N - 1:

        ll = N - K

        count += 1

        while ll > r:

            ll -= (K - 1)

            count += 1

    print(count)

    

    return 0



if __name__ == "__main__":

    solve()
import sys



def solve():

    input = sys.stdin.readline

    N, K = list(map(int, input().split()))

    A = [int(a) for a in input().split()]

    mid = A.index(1)

    count = 1

    r = K - 1

    while r < mid:

        r += (K - 1)

        count += 1



    if r < N - 1:

        l = N - K

        count += 1

        while l > r:

            l -= (K - 1)

            count += 1

    print(count)





    return 0



if __name__ == "__main__":

    solve()
import sys
from collections import deque


def solve():
    input = sys.stdin.readline
    N, K = list(map(int, input().split()))
    A = [int(a) for a in input().split()]
    l = A.index(1)
    count = 1
    r = K - 1
    while r < l:
        r += K - 1
        count += 1
    if r < N - 1:
        ll = N - K
        count += 1
        while ll > r:
            ll -= K - 1
            count += 1
    print(count)
    return 0


if __name__ == "__main__":
    solve()

import sys


def solve():
    input = sys.stdin.readline
    N, K = list(map(int, input().split()))
    A = [int(a) for a in input().split()]
    mid = A.index(1)
    count = 1
    r = K - 1
    while r < mid:
        r += K - 1
        count += 1
    if r < N - 1:
        l = N - K
        count += 1
        while l > r:
            l -= K - 1
            count += 1
    print(count)
    return 0


if __name__ == "__main__":
    solve()

-from collections import deque -    l = A.index(1) +    mid = A.index(1) -    while r < l: +    while r < mid: -        ll = N - K +        l = N - K -        while ll > r: -            ll -= K - 1 +        while l > r: +            l -= K - 1