def main():

    N, K = (int(i) for i in input().split())

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

    mi = min(A)

    idx = A.index(mi)

    h1 = idx

    h2 = N - idx - 1

    ans = N

    for k in range(K):

        cur = (max(0, (h1 - k))+(K-1)-1)//(K-1) + \

            (max(0, (h2 - ((K-1) - k)))+(K-1)-1)//(K-1) + 1

        ans = min(ans, cur)

    print(ans)





if __name__ == '__main__':

    main()

def main():

    import sys

    input = sys.stdin.buffer.readline

    N, K = (int(i)-1 for i in input().split())

    _ = [int(i) for i in input().split()]

    print(((N + K - 1)//K))





if __name__ == '__main__':

    main()

def main():
    N, K = (int(i) for i in input().split())
    A = [int(i) for i in input().split()]
    mi = min(A)
    idx = A.index(mi)
    h1 = idx
    h2 = N - idx - 1
    ans = N
    for k in range(K):
        cur = (
            (max(0, (h1 - k)) + (K - 1) - 1) // (K - 1)
            + (max(0, (h2 - ((K - 1) - k))) + (K - 1) - 1) // (K - 1)
            + 1
        )
        ans = min(ans, cur)
    print(ans)


if __name__ == "__main__":
    main()

def main():
    import sys

    input = sys.stdin.buffer.readline
    N, K = (int(i) - 1 for i in input().split())
    _ = [int(i) for i in input().split()]
    print(((N + K - 1) // K))


if __name__ == "__main__":
    main()

-    N, K = (int(i) for i in input().split()) -    A = [int(i) for i in input().split()] -    mi = min(A) -    idx = A.index(mi) -    h1 = idx -    h2 = N - idx - 1 -    ans = N -    for k in range(K): -        cur = ( -            (max(0, (h1 - k)) + (K - 1) - 1) // (K - 1) -            + (max(0, (h2 - ((K - 1) - k))) + (K - 1) - 1) // (K - 1) -            + 1 -        ) -        ans = min(ans, cur) -    print(ans) +    import sys + +    input = sys.stdin.buffer.readline +    N, K = (int(i) - 1 for i in input().split()) +    _ = [int(i) for i in input().split()] +    print(((N + K - 1) // K))