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

index_of_1 = A.index(1)

if index_of_1 == 0:
    first = 0
else:
    first = math.ceil((index_of_1 + 1) / K)

if index_of_1 == N - 1:
    latter = 0
else:
    latter = math.ceil((N - index_of_1 + 1) / K)

print(first + latter)
