count = 0
N,K = map(int,input().split( ))
J = list(map(int,input().split( )))
for i,j in zip(range(N),J):
    if j==1:
        s = i
        t = N-1-i
for _ in range(N+N):
    if s<=0:
        break
    else:
        s -= K-1
        count += 1

for _ in range(N+N):
    if t<=0:
        break
    else:
        t -= K-1
        count += 1
        
if N<=K:
    count = 1
print(count)