program a

integer :: i,j,k,l,m,n,basho,left,right,n_left,n_right,n_total=9999999
integer :: aaa(100000)

read(*,*) n,k
read(*,*) (aaa(i),i=1,n)

do i = 1,n
if(aaa(i) == 1) then
basho = i
endif
enddo


do j=0,k-1
left = max(0,basho-1-(k-j-1))
right = max(0,n-basho-j)
n_left = left / (k-1)
n_right = right / (k-1)
if(mod(left,k-1) /= 0)then
n_left = n_left + 1
endif
if(mod(right,k-1) /= 0)then
n_right = n_right + 1
endif
n_total = min(n_total,n_left+n_right+1)
enddo

write(*,*) n_total

end program