peterverebics/CodeNet_Python_118 huggingface dataset:
n,k=map(int,input().split())
a = list(map(int,input().split()))

if n % k == 0:
  print(int(n/k))
else:
  print(int(n/k)+1)
N,K=map(int,input().split())
List = list(map(int, input().split()))
k=K-1
n = (N-1)/k
nn = int(n)
if n-nn > 0:
  n = nn+1
print(n)
import math
n,k = map(int,input().split())
a = list(map(int,input().split()))
if k >= n:
    print(1)
    exit()
s = a.index(1)
left = s
right = n - (s + 1)
if left < k-1:
    right -= ((k-1) - left)
if right < k-1:
    left -= ((k-1) - right)
print(math.ceil(left / (k-1)) + math.ceil(right / (k-1)))
import math
n, k = map(int,input().split())
input()
print((n-1)/(k-1), math.ceil((n - 1)/(k - 1)))
Len, Split = map(int, input().split())
print(int(Len / (Split - 1)))
import math
n,k = map(int,input().split())
ls = list(map(int,input().split()))
a = min(ls)
i = ls.index(a)
l = i
r = n - i - 1
print(int(math.ceil(l/(k-1))+math.ceil(r/(k-1))))
n,k = map(int, raw_input().split())
print (n + k - 1)/k
a,b=map(int,input().split())
n=list(map(int,input().split()))
if a==b:
    print(1)
    exit()
m=n.index(min(n))
o=len(n[:m-1])
p=len(n[m+2:-1])
ans=(o//(b-1))+(min(o%(b-1),1))+(p//(b-1))+(min(p%(b-1),1))
print(ans+1)
n,k = map(int, input().split( ))
*a, = map(int, input().split( ))

i = a.index(1)

if (i-1)%(k-1)+(n-i)%(k-1)==n-1:
    print((n-1)//(k-1))
else:
    print((n-1)//(k-1)+1)
import math
n,k = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]

first = a.index(1)

b_num = math.ceil(len(a[:first]) / (k-1))
a_num = math.ceil(len(a[first+1:]) / (k-1))
#print(b_num)
#print(a_num)

print(b_num+a_num)
n , k = map(int,input().split())
l = list(map(int,input().split()))
m = l.index(min(l))
if k <= m:
    ans = (m + 1) //k + 1 + (n -m) // k +1
if k > m:
    o = k - m 
    ans = (k - o) // k + 1
import math
n,k = map(int,input().split())
ls = list(map(int,input().split()))
a = min(ls)
i = ls.index(a)
l = i
r = n - i - 1
if r < l:
    i,r = r,l
if n == k:
    print("1")
elif l < k-1:
    print(int(r-k+1+l)+1)
else:
    print(int(math.ceil(l/(k-1))+math.ceil(r/(k-1))))
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

n,k = map(int,input().split())
a = list(map(int,input().split()))
for i in range(n):
    if a[i] == 1:
        check = i
        break
left = check
right = n - check -1
ans = left//(k-1) + right//(k-1)
if left%(k-1) != 0:
    ans += 1
if right%(k-1) != 0:
    ans += 1
print(ans)
n,k = map(int,input().split())

lst =  list(map(int,input().split()))

id_one = lst.index(1)
left_length = len(lst[0:id_one])-1
right_length = len(lst[id_one:])-1

counter = 0

if left_length > 0:
    left_length -= k
    counter += 1

while left_length > 0:
    counter += 1
    left_length -= k-1

if right_length > 0:
    counter += 1
    right_length -= k

while right_length > 0:
    counter += 1
    right_length -= k-1

print(counter)
# coding: utf-8
# Your code here!
import math
N,K=map(int,input().split())
A=list(map(int,input().split()))
m=A.index(1)
ans=0
l=m
#print(l)
while l>0:
    ans+=1
    l-=(K-1)
l=m
#print(ans)
while l<N-1:
    ans+=1
    l+=(K-1)
print(ans)
n,k = map(int,input().split())
a = [int(i) for i in input().split()]
print(n // (k-1))
import math
N,K = list(map(int, input().split()))
A = list(map(int, input().split()))

print(math.floor(N / (K - 1)))
N, K = map(int, input().split())
l = list(map(int, input().split()))
index = l.index(1) + 1

ans = 0
# 0よりも左があるなら左を計算
if index != 0:
    p = index - K
    ans += 1
    if p < 0:
        index = K
    p += 1
    while p > 0:
        p = p - K
        ans += 1
# 0よりも右があるなら右を計算
while index < N:
    index = index + (K - 1)
    ans += 1

print(ans)
from math import ceil

N, K = map(int, input().split())
ll = list(map(int, input().split()))

idx = ll.index(1)

l, r = idx, N-idx

print(ceil((l)/(K-1))+ ceil((r-1)/(K-1)))
# C - Minimization

N, K = map(int, input().split())
A = list(int(a) for a in input().split())
ans = 0

idx1 = A.index(1)
ans += (idx1+(K-2)) // (K-1)
ans += ((N-1-idx1)+(K-2)) // (K-1)

print(ans)
import math


def calc_process_num(n):
    return 1 + math.ceil((n - K)/(K - 1))


N, K = map(int, input().split())
A = list(map(int, input().split()))
idx_minA = A.index(min(A)) + 1
if N <= K:
    print(1)
else:
    print(calc_process_num(idx_minA) + calc_process_num(N - idx_minA + 1))
n, k = map(int, input().split())
a = list(map(int, input().split()))

ind = a.index(1)
cnt = k - 1
ans = 0
for i in reversed(range(ind)):
    cnt -= 1
    if cnt == 0:
        ans += 1
        cnt = k - 1

if n > k:
    cnt = k - 1
for i in range(ind, n):
    cnt -= 1
    if cnt == 0:
        ans += 1
        cnt = k - 1

print(ans)
def main():
    import sys
    input = sys.stdin.readline
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    ans = []
    for x in range(1, N+1):
        if x > (N-K)/(K-1) and x <= N/(K-1):
            ans.append(x)
    print(min(ans))
main()
n, k = map(int, input().split())
s = list(map(int, input().split()))
m = n//k
count = m*(m+1)//2
print(count+1 if n%k else count)
import math

n, k = map(int,input().split())
a = list(map(int,input().split()))

l = a.index(1)
r = n - l - 1

if n == k:
    print(1)
else:
    ans = math.ceil(l/(k-1))+ math.ceil(r/(k-1))
    print(ans)
def main():
    from math import ceil
    n, k, *a = map(int, open(0).read().split())
    i = a.index(1)
    if i in [0, n - 2]:
        ans = 1 + ceil((n - k) / (k - 2))
    else:
        k -= 1
        l, r = max(0, i - 1), max(0, n - i - 2)
        ans = 1 + ceil(l / k) + ceil(r / k)

    print(ans)


if __name__ == '__main__':
    main()
import math
N,K = list(map(int, input().split()))
A = list(map(int, input().split()))

ans = 1

idx = A.index(1)
cnt = 1
right = idx
left = idx
while True:
  for i in range(1, K):
    right += 1
    if(right < len(A)):  
      A[right] = 1
    else:
      left -= 1
      if(0 <= left):
        A[left] = 1
      else:
        print(cnt)
        exit()
  if(left == 0 and len(A)-1 == right):
    print(cnt)
    exit()
  else:
    cnt += 1
N, K = map(int, input().split())
if N == K:
    print(1)
    quit()
A = tuple(map(int, input().split()))
left = A.index(1)
right = N - left - 1
div_l, rem_l = divmod(left, K - 1)
div_r, rem_r = divmod(right, K - 1)
print(div_l + bool(rem_l) + div_r + bool(rem_r))
from math import ceil

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

if N == K:
    print(1)
    exit()

print(ceil((N - K + 1) / (K - 1)) + 1)
n,k = map(int,input().split())
a_ls = list(map(int, input().split()))

min_ind = a_ls.index(min(a_ls))
left_len = min_ind
right_len = n - min_ind - 1
one_stroke = k - 1
left_num = -(-left_len // one_stroke)
right_num = -(-right_len // one_stroke)
ans = left_num + right_num
if n == k:
    ans = 1

print(ans)
n,k=map(int,input().split())
a=list(map(int,input().split()))
print(n//(k-1))
from collections import Counter

n, k = map(int, input().split())
A = [int(x) for x in input().split()]
# most common value
mcv = Counter(A).most_common()[0][0]
idx = 0
ans = 0
while True:
    if idx >= n:
        break
    if A[idx] == mcv:
        idx += 1
        continue
    idx += k - 1
    ans += 1
print(ans)
def calc_process_num(n):
    if n == 1:
        return 0
    elif n <= K:
        return 1
    else:
        return 1 + int((n - K) / (K - 1)) if (n - K) % (K - 1) == 0 else 2 + int((n - K) / (K - 1))


N, K = map(int, input().split())
A = list(map(int, input().split()))
idx_minA = A.index(min(A)) + 1

if N <= K:
    print(1)
else:
    print(calc_process_num(idx_minA) + calc_process_num(N - idx_minA + 1))
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
import bisect
n,k=map(int,input().split())
a=list(map(int,input().split()))
ans=10**9
ix=a.index(1)
ans=math.ceil(ix/(k-1))+math.ceil((n-ix-1)/(k-1))
print(ans)
#解説参照
#前の版のn+k-2をm+k-1に修正
#1の両側調整とか考えたのが間違い
#端から貪欲と変わらない

#a要らない気がした
n,k = map(int,input().split( ))
print((n+k-1)//(k-1))
import math

n, k = map(int, input().split())
lst = list(map(int, input().split()))

num = lst.index(1)

if k-1<=num and k-1<=n-num-1:
    print(math.ceil(num/(k-1))+math.ceil((n-num-1)/(k-1)))
else:
    print(math.ceil(n/k))
n,k=map(int,input().split())
a=list(map(int,input().split()))

num_1=a.index(1)
if num_1%(k-1)==0:
    left=num_1//(k-1)
else:
    left=num_1//(k-1)+1
if (n-1-num_1)%(k-1)==0:
    right=(n-1-num_1)//(k-1)
else:
    right=(n-1-num_1)//(k-1)+1
ans=left+right
print(ans)
n,k = map(int,input().split())
a = list(map(int,input().split()))
o = a.index(1)
ans = 0
if o==0 or o==n-1 :
    ans = -(-(n-1)//(k-1))
else:
    ans = -(-o//k)+-(-(n-o-1)//(k-1))
print(ans)
import math

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

ans=math.ceil(N/K)


print(ans)
n , k = map(int,input().split())
print((n-1)//k-2+1)
n, k = map(int, input().split())
a = list(map(int, input().split()))

if k < n:
    print(-((-n)//(k-1)))
else:
    print(1)
N,K = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
count = 0
for i in range(0,N,K-1):
  count += 1
  if N == K:
    break
print(count)
import math

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

i = A.index(1)

print(math.ceil(i/(K-1))+ math.ceil((N-i-1)/(K-1)))
import math
n, k = map(int, input().split())
a = list(map(int, input().split()))
print(math.ceil(n // (k-1)))
n,k = map(int,input().split())
a = [int(i) for i in input().split()]
if n == k:
    print(1)
else:
    b = a.index(1)
    c,d = divmod(b,k-1)
    ans = c
    if d != 0:
        ans +=1
    e = n-1 -b
    c,d = divmod(e,k-1)
    ans += c
    if d != 0:
        ans +=1
    print(ans)
Len, Split = map(int, input().split())
_res = Len % Split
if _res:
    print(int((Len / (Split - 1))) + 1)
else:
    print(int((Len / (Split - 1))))
N,K=map(int,input().split())
x=list(map(int,input().split()))
if N//K==0:
  print(N//K)
else:
  print(N//K+1)
import math
N,K = map(int,input().split())
A = list(map(int,input().split()))

if N <= K:
  cnt = 1
else:
  i = A.index(1)
  left = i
  right = N - i - 1

  cnt = math.ceil(left / (K - 1)) + math.ceil(right / (K - 1))

print(cnt)
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, K, *A = map(int, read().split())

    print(N // (K - 1))

    return


if __name__ == '__main__':
    main()
import numpy as np
n, k = map(int, input().split())
A = list(map(int, input().split()))
a = np.argmin(A)
if a != 0 and a < k-1:
  ans_1 = 1
  a = k-1
else:
  ans_1 = (a)//(k-1)
  a = ans_1*(k-1)
if n-a-1 != 0 and n-a < k-1:
  ans_2 =  1
else:
  ans_2 = (n-a)//(k-1)
print(ans_1 + ans_2)
import math
n, k = map(int,input().split())
a = list(map(int,input().split()))
ans = math.floor(n/(k-1))
print(ans)
from math import ceil
N, K = map(int, input().split())
A = list(map(int, input().split()))
print(ceil(N/(K-1)))
n,k = map(int,input().split())

lst =  list(map(int,input().split()))

id_one = lst.index(1)
left_length = len(lst[0:id_one])
#print(left_length)
right_length = len(lst[id_one:])-1
#print(right_length)
counter = 0



while left_length > 0:
    counter += 1
    left_length -= k-1


while right_length > 0:
    counter += 1
    right_length -= k-1

print(counter)
n, k = [ int(x) for x in input().split(' ') ]
xs = [  int(x) for x in input().split(' ') ]
i0 = xs.index(min(xs))
print(1 + min([ (i + k - 2) // (k - 1) + (n - i - 1) // (k - 1)
  for i in range(max(i0 - k + 1, 0),  min(i0, n - k) + 1)  ]))
import math
def resolve():
	n, k = map(int, input().split())
	a = list(map(int, input().split()))
	i = a.index(min(a))
	v = math.ceil(i/2) + math.ceil((n-1-i)/2)
	print(v)
resolve()
import sys
import math

N, K = map(int, input().split())
li = list(map(int, input().split()))

if N <= K:
  print(1)
  sys.exit()

print(math.ceil(N / (K-1)))
n,k=map(int,input().split());print(-~~-n//~-k)
import math

n, k = map(int, input().split())
lst = list(map(int, input().split()))

num = lst.index(1)

if k-1<=num and k-1<=n-num:
    print(math.ceil(num/(k-1))+math.ceil((n-num-1)/(k-1)))
else:
    print(math.ceil(n/k))
import sys
input = sys.stdin.readline

def main():
	N,K=map(int,input().split())
	A=list(map(int,input().split()))
	num=0
	ans=0
	for i in range(N):
		if A[i]==1:
			num=i
			break
	if i==0:
		ans=(N-1+(K-1)-1)//(K-1)
		print(ans)
	else:
		ans+=(num+(K-1)-1)//(K-1)
		ans+=(N-num+(K-1)-1)//(K-1)
		print(ans)
if __name__=='__main__':
	main()
import math

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
# print(N, K, A)

answer = math.ceil(N / (K - 1))

print(answer)
def main():
    n, k = list(map(int, input().split()))
    A = list(map(int, input().split()))
    i_min = A.index(1)
    ans = -(-i_min // (k - 1)) -(-(n - i_min - 1) // (k - 1))
    print(ans)

if __name__ == '__main__':
    main()
n,k=map(int,input().split())
if n==k:
  print(1)
elif n%(k-1)==1:
  print(n//(k-1))
else:
  print((n+k-2)//(k-1))
N,K = (int(X) for X in input().split())
A  = [int(X) for X in input().split()]
Left  = A.index(1)
Right = (N-1)-Left
Count = (Right%(K-1)!=0)+Right//2
Left  = max(0,Left-Right%(K-1))
Count += (Left%(K-1)!=0)+Left//2
print(Count)
N, K = map(int,input().split())
Alist = list(map(int,input().split()))
print(-(-N-1//K-1))
import math
N, K = map(int,input().split())
A = list(map(int,input().split()))
index = 0
for i in range(N):
    if A[i] < A[index]:
        index = i
print(math.ceil(index / (K-1)) + math.ceil((N-index-1) / (K-1)))
N,K = list(map(int, input().split()))
A = list(map(int, input().split()))

ans = (N // (K-1))
print(ans)
n,k=map(int,input().split())
a = list(map(int,input().split()))

if n % k == 0:
  print(int(n/k))
elif n % (k-1) == 0:
  print(int(n/(k-1)))
else:
  print(int(n/(k-1)+1))
n, k = map(int, input().split())
a = list(map(int, input().split()))

m = n-k
if n>k:
  print(m//(k-1) + 2)
else:
  print(m//(k-1) + 1)
N, K = map(int, input().split())
A = list(map(int, input().split()))

print(N // (K - 1))
n, k = map(int, input().split())
a = list(map(int , input().split()))
idx = a.index(1)
l = idx + 1
r = n - idx
if n == k:
    print(1)
    exit()
ln = 1
if l >= k:
    ln = l // (k-1)
rn = 1
if r >= k:
    rn = r // (k-1)

print(ln + rn)
N,K = map(int,input().split())
A = list(map(int,input().split()))

i = 0
cnt = 0
while True:
    if N == K:
        cnt += 1
        #print(1)
        break
    ans = A[i*2:i*2+K]
    if not ans:
        break
    i+=1
    #print(ans)
    cnt +=1
print(cnt)
n, k = map(int, input().split())
a = list(map(int, input().split()))

if n>k:
  print((n+1)//k+1)
else:
  print(1)
N,K=map(int,input().split())
x=list(map(int,input().split()))

if N%K==0:
  print(N//K)
else:
  print(N//K+1)
import math
N, K = map(int, input().split())
A = list(map(int, input().split()))
A_min = min(A)
index = A.index(A_min)
ans = 0
left = index
right = N - 1 - index
if left % (K - 1) == 1:
    right -= 1
elif right % (K - 1) == 1:
    left -= 1
ans += math.ceil(left / (K - 1))
ans += math.ceil(right / (K - 1))   
print(ans)
n,k = map(int,input().split())
a = list(map(int, input().split()))
print(1 if n==k else 1+(n-1)//(k-1))
n,k = map(int, input().split())

al = list(map(int, input().split())) 

if n==k:
    print(1)
    exit()
    
x = n//(k-1)
y = n%(k-1)

if y >0:
    print(x+1)
else:
    print(x)
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10**9)
mod = 10**9+7

N,K = I()
A = l()
m = min(A)
start = 0
ans = 0
for i in range(N):
    if A[i] == m:
        ans += math.ceil((i-start)/(K-1))
        start = i+1
ans += math.ceil((N-start)/(K-1))
print(ans)
n, k = map(int, input().split())
As = list(map(int, input().split()))
idx = As.index(1)
nf = n-1 - idx
nb = idx
ans = 0
while nf > 0:
  nf -= k-1
  ans += 1
while nb > 0:
  nb -= k-1
  ans += 1
print(ans)
import math
n,k = map(int,input().split())
ls = list(map(int,input().split()))
a = min(ls)
i = ls.index(a)
l = i
r = n - i - 1
if r < l:
    l,r = r,l
if n == k:
    print("1")
elif l < k-1:
    print(int(r-k+1+l)+1)
else:
    print(int(math.ceil(l/(k-1))+math.ceil(r/(k-1))))
N,K=map(int,input().split())
A=list(map(int,input().split()))
ans=-(-A.index(1))//(K-1)-(-N+A.index(1)+1)//(K-1)
print(ans)
n, k = map(int, input().split())
A = [int(x) for x in input().split()]
i1 = A.index(1)
ans = 0
tmp = i1
while True:
    if tmp <= 0:
        break
    tmp -= k - 1
    ans += 1
tmp = i1
while True:
    if n - 1 <= tmp:
        break
    tmp += k - 1
    ans += 1
print(ans)
n, k = map(int, input().split())

a = list(map(int, input().split()))
k -= 1
ans = n // k

print(ans)
n, k = map(int, input().split())
A = list(map(int, input().split()))

idx = A.index(1)
d = k-1
if idx == 0 or idx == n-1:
  ans = (n - 1 + d - 1) // d
elif idx <= k-1 or n-k <= idx:
  ans = 1 + (n - k + d - 1) // d
else:
  ans = (idx + d - 1) // d + (n - idx - 1 + d - 1) // d

print(ans)
N, K = map(int, input().split())
A = [int(x) for x in input().split()]

c = 0
while N > 0:
    c += 1
    N -= K-1
print(c)
# https://atcoder.jp/contests/abc101/tasks/arc099_a


import sys
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


N, K = read_ints()
A = read_ints()
K -= 1
i = A.index(1)
right = (i - 1) // K + 1
left = (N - 1 - i - 1) // K + 1

# コーナーケース対策
print(right + left if N != K else 1)
N,K=map(int,input().split())
A=list(map(int,input().split()))

if K == N:
  print(1)
  exit()
  
MIN = min(A)

argmin=[]
for i in range(N):
  if A[i]==MIN:argmin.append(i)
    
a = argmin[0]
SUM=0
SUM += (a+(K-2)) // (K-1)
SUM += ((N-1-a)+(K-2))//(K-1)

print(SUM)
n, k = map(int, input().split())

a = list(map(int, input().split()))

mn = 0
for i in range(n):
    mn = min(mn, a[i])

ans = 0

if (k != 1):
    k -= 1

for i in range(0, n, k):
    ans += 1

if n == k + 1 or k == 1:
    ans -= 1

print(ans)
import math
n,k=map(int,input().split())
a=[int(x) for x in input().split()]
print(math.ceil(n/k))
N , K = map(int,input().split())
print(N//(K-1))
import math
N, K = map(int, input().split())
arr = list(map(int, input().split()))

if N == K:
    print(1)
    exit()

mae = arr.index(1)
usiro = len(arr)-1-arr.index(1)
ans = math.ceil(mae/(K-1))+math.ceil(usiro/(K-1))

if mae ==0 or mae ==N-1:
    print(ans-1)
    exit()
else:
    print(ans)
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

N,K = MI()
A = LI()

i = A.index(1)
j = N-1-i
print((i+1)//2 + (j+1)//2)
N,K=map(int,input().split())
A=list(map(int,input().split()))
result=-(-len(A)//K)
print(result)
import math
n,k = map(int,input().split())
a = list(map(int,input().split()))
m = 0
for i in range(n):
  if a[i] == 1:
    m = i
    break
print(math.ceil((i-1)/(k-1))+math.ceil((n-i)/(k-1)))
N,K=map(int,input().split())
a=list(map(int,input().split()))
index=a.index(1)
l=index
r=index
cnt=0
while l!=0:
  if cnt==0:
    if l-K+1<0:
      r=K-1
  l=max(0,l-K+1)
  cnt+=1
while r!=N-1:
  r=min(N-1,r+K-1)
  cnt+=1
print(cnt)
n, k = map(int, input().split())
a = list(map(int, input().split()))

if k < n:
    left = a.index(1)

    if left % (k - 1) == 0:
        ans = left // (k - 1)
    else:
        ans = (left // (k - 1)) + 1

    right = n - left - 1

    if right % (k - 1) == 0:
        ans += right // (k - 1)
    else:
        ans += (right // (k - 1)) + 1
else:
    ans = 1
print(ans)
from math import ceil
import sys

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

if N == K:
    print(1)
    sys.exit()

idx = A.index(1)

ans = ceil((N - idx) / 2)
ans += idx // 2

print(ans)
n, k = map(int, input().split())
a = list(map(int, input().split()))
if n==k:
  print(1)
else:
  print((n+k-2)//(k-1))
N,K = map(int, input().split())
A=list(map(int,input().split()))

min_num=min(A)
count=K-1

print(int(-(-len(A)/count)))
import math
N, K = map(int, input().split())
A = list(map(int, input().split()))
A_min = min(A)
cnt = 0
now = 0
for i in range(N):
    if A[i] == A_min:
        if now == 0:
            cnt += math.ceil((i - now) / 2)
            now = i
        else:
            cnt += math.ceil((i - now - 1) / 2)
            now = i
        if (i - now) % 2 == 1:
                now += 1
cnt += math.ceil((N - 1 - now) / 2)
print(cnt)
N,K = list(map(int, input().split()))
A = list(map(int, input().split()))

print(N // (K - 1))
import math

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

if((N+1)/K==2):
    print(math.ceil(N/(K-1)))
elif(N!=K):
    print(2)
else:
    print(1)
N,K=map(int,input().split())
alist=list(map(int,input().split()))

print(N//(K-1))
#!/usr/bin/env python3
import math

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

index = a.index(1)

pre = index
post = n-index-1

post = max(post - pre % (k-1), 0)

ans = 0
ans += math.ceil(pre/(k-1))
ans += math.ceil(post/(k-1))

print(ans)
def resolve():
    import math
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    one = A.index(1)+1
    print(math.ceil((one-1)/(K-1))+math.ceil((N-one)/(K-1)))
resolve()
N, K = map(int,input().split())
Alist = list(map(int,input().split()))
n = 0
for i in range(N):
    if Alist[i] == 1:
        p = i
n = n -(-p//(K-1))
n = n -(-(N-p-1)//(K-1))
print(n)
import math

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

if((N+1)/K==2):
    print(2)
elif(N!=K):
    print(math.ceil(N/(K-1)))
else:
    print(1)
n,k=map(int,input().split())
k-=1
a=list(map(int, input().split()))
for i in range(n):
    if a[i]==1:
        index=i
print(-(-index//k)-(-(n-index-1)//k))#pythonで切り上げの書き方
n, k = map(int, input().split())
As = list(map(int, input().split()))

idx = As.index(min(As))
left = idx
right = n - idx - 1

n_l = (left + k - 2) // (k - 1)
n_r = (right + k - 2) // (k - 1)

print(n_l + n_r)
n,k=map(int,input().split())
a = list(map(int,input().split()))

print((n-1)//(k-1))
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n,k = nm()
a = nl()

m = min(a)

ans=0
cnt=0
for i in range(n):
  cnt+=1
  if cnt == k:
    ans+=1
    cnt=1
    
  if a[i]==m:
    cnt=1
  
if cnt!=1:
  ans+=1 

print(ans)
x, y = map(int,input().split())
li = list(map(int,input().split()))
a = li.index(1)
b = x-a+1
if x == y:
    print(1)
else:
    print(a//(y-1)+b//(y-1))
n,k=map(int,input().split())
a=list(map(int,input().split()))
z=a.index(1)
L= -(-z//(k-1))
R=-(-(n-z-1)//(k-1))
if z%(k-1)+(n-z-1)%(k-1)>=k:
    print(L+R-1)
else:
    print(L+R)
#!/usr/bin/env python3
# スペース区切りの整数の入力
n, k = map(int, input().split())
#配列の入力
data = list(map(int, input().split()))
min = data.index(1)
ret = 0
a = len(data[:min])-1
b = len(data[min:])-1
#print(a)
#print(b)

if a > 0:
    ret += -(-a // (k-1))
if b > 0:
    ret += -(-b // (k-1))

print(ret)
N,K = map(int,input().split())
A = list(map(int,input().split()))

if (N-1)%(K-1) == 0:
    print(N-1//K-1)
else:
    print(N-1//K-1 + 1)
n,k = map(int,input().split())
a = [int(i) for i in input().split()]

b = a.index(1) 
if b < k-1:
    b += k-1 -b
if b > (n-1) -(k-1):
    b -= b - (k-1)
c,d = divmod(b,k-1)
ans = c
rem = d
if d != 0:
    ans +=1
e = n-1 -b
c,d = divmod(e,k-1)
ans += c
if d != 0:
    ans +=1
if rem + d <= k-1:
    ans -=1
print(ans)
n,k = map(int,input().split())
a = list(map(int,input().split()))
print((n-1) // (k-1))
n, k = map(int, input().split())
a = list(map(int, input().split()))

if (n-k)%(k-1) ==0:
  print((n-k)//(k-1)+1)
else:
  print((n-k)//(k-1)+3)
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n,k = nm()
a = nl()
import math
for i in range(n):
  if a[i]==1:
    x = math.ceil(i/(k-1))
    y = math.ceil((n-i-1)/(k-1))
    ans = x+y

print(ans)
n,k=map(int,input().split());a=list(map(int,input().split()))
print(int(n/(k-1)))