n,k=map(int,input().split())
a=[int(i) for i in input().split()]
chk=a.index(1)
l=chk
r=n-(chk+1)
t1=l%(k-1)
t2=r%(k-1)
print(min(l//(k-1)+r//(k-1),((l-t2)//(k-1))+(r//(k-1)), (l//(k-1))+((r-t1)//(k-1))))
