import math
n,k=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n):
	if a[i]==1:
		break
p=i
k-=1

#print(ans)
x=0
for j in range(n-1,p,-k):
	x+=1
#print(x)
for j in range(0,p,k):
	x+=1
y=p%k+1+(n-p-1)%k
if p%k>0 and (n-p-1)%k>0 and y<=k+1:
	x-=1
print(x)
