peterverebics/CodeNet_Python_118 huggingface dataset:
n,k=(int(i) for i in input().strip().split(" "))
ar=[int(i) for i in input().strip().split(" ")]
from math import ceil
pos=ar.index(1)
a=n-1-pos
b=pos
ans=ceil(a/(k-1))
ans+=ceil(b/(k-1))
print(ans)
import math
N,K = list(map(int, input().split()))
A = list(map(int, input().split()))

if(K-1 == 1):
  print(N - 1)
else:
  print(N // (K - 1))
N, K = map(int, input().split())
A = list(map(int, input().split()))

# 1の場所を探す
pos = A.index(1)

count = 0
range_s = pos - 1  # 1でない前方位置はここまで
range_e = pos + 1  # 1でない後方位置はここから
while range_s >= 0:  # 先頭まで1にする
    range_s -= K-1
    count += 1
while range_e < N:  # 末尾まで1にする
    range_e += K-1
    count += 1
print(count)
n, k = map(int, input().split())
a = list(map(int, input().split()))
x = a.index(1)
left = x
right = n - x - 1

ans = n
for i in range(k):
    if left < i:
        continue
    a = left - i + 1
    if right - k + 2 + i < 0:
        continue
    b = right - k + 2 + i
    print(a, b)
    w = a//(k-1) + b//(k-1)
    ans = min(ans, w)
print(ans + 1)
def LI():
	return [ int(s) for s in input().split() ]
  
N,K = LI()

print(N//K + 1) if N%K != 0 else print(N//K)
N, K = map(int, input().split())
arr = list(map(int, input().split()))
index = arr.index(1) + 1
left = -(-(index - 3)//2) + 1
right = -(-(N - index + 1 - 3)//2) + 1
print(left+right)
import math
N,K=map(int,input().split())
A=list(map(int,input().split()))
if N==K:
    print(1)
else:
    print(math.ceil(N/(K-1)))
import math

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

answer = math.ceil(min_index/(K-1)) + math.ceil((N-min_index-1)/(K-1))
print(answer)
N, K = map(int, input().split())
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))
import sys
input = sys.stdin.readline

def main():
    N, K = [int(x) for x in input().split()]
    A = [int(x) for x in input().split()]

    x = A.index(1)
    print(x // (K - 1) + (N - x) // (K - 1))




if __name__ == '__main__':
    main()
n, k = 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()))

for i in range(N):
  if A[i] == 1:
    n = i

n = n+1    

def main(M,P):
  cnt = 1
  while True:
    M -= P
    M += 1
    if M > P:
      cnt += 1
    if M == 0:
      break
    if M != 0 and P > M:
      cnt += 1
      break
  return cnt

if N == K:
  print("1")
  
elif K >= n :
  print(main(N,K))
  
else :
  N1 = n
  N2 = N-n+1
  print(main(N1,K)+main(N2,K))
import sys
import math
mod=10**9+7
inf=float("inf")
from math import sqrt
from collections import deque
from collections import Counter
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from functools import lru_cache
#メモ化再帰defの冒頭に毎回 @lru_cache(maxsize=10**10)
#引数にlistはだめ
#######ここまでテンプレ#######
#######ここから天ぷら########
n,k=map(int,input().split())
ans=1
now=k
while now<n:
    n= n-k+1
    ans+=1
    now+=k-1
print(ans)
def main():
    N, K = map(int, input().split())
    A = input()
    if N == K:
        print('1')
    elif N % (K-1) == 0:
        print(N//(K-1))
    else:
        print(N//(K-1) + 1)
main()
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left, bisect_right #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

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

mi = A.index(1)
lc = (mi+1)//2
rc = (N-mi)//2

print(lc+rc)
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



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


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

print(counter)
import math
N, K = map(int,input().split())
A = list(map(int,input().split()))
print(int(N/(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-1)
ans += (N-idx1) // (K-1)

print(ans)
N, K = map(int, input().split())
l = list(map(int, input().split()))
index = l.index(1) + 1

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

print(ans)
import math
N, K = map(int, input().split())
A = list(map(int, input().split()))
index = A.index(min(A))
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()))

i = a.index(1)

s = n

for j in range(i-k+1, i+1):
    if j < 0:
        continue
    elif j >= n:
        continue
    else:
        l = j
        u = (n-1-j)
        t = (l+1) // (k-1) + (u+1) // (k-1)
        #print(t)
        s = min(s, t)

print(s)
from math import ceil

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

if start == 0 or start == n-1:
    print(ceil((n-1)/2))
else:
    print(ceil((start-1)/2) + 1 + ceil((n-start-2)/2))
n, k = map(int, input().split())
lis = list(map(int, input().split()))

if n == k:
    print(1)
else:
    print(n//(k-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
print(count)
n,k=map(int,input().split())
a=list(map(int,input().split()))

index = a.index(1)
left = a[:index]
right = a[index+1:]

import math
num_left = math.ceil( len(left)/(k-1) )
num_right = math.ceil( len(right)/(k-1) )
print(num_left+num_right)
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
if n<=k:
  print(1)
  exit()
n=n-k
if n%k==0:
  print(1+n//(k-1))
else:
  print(1+n//(k-1)+1)
import math
n,k=map(int,input().split())
a=list(map(int,input().split()))
ind=10**7
ans=0
for i in range(n):
  if a[i]==1:
    ind=i
    break
ans+=math.ceil(ind/(k-1))+math.ceil((n-ind)/(k-1))

print(ans)
from math import ceil
n,k = map(int, input().split())
a = list(map(int, input().split()))

t = a.index(1)
print(ceil(t/(k-1)) + ceil((n-1-t)/(k-1)))
import math

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

if n <= k:
    print(1)
else:
    print(n//(k-1))
n, k = map(int, input().split())
A = list(map(int, input().split()))
answer = 50001
while True:
    if n <= k + (k - 1) * (answer - 1):
        answer -= 1
    else:
        break

print(answer + 1)
import math

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

if(N!=K):
    print(math.ceil(N/(K-1)))
else:
    print(1)
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
#======================================================#
def main():
    n, k = MII()
    aa = MII()
    print((-(-n//(k-1))) if n > 3 else 1)


if __name__ == '__main__':
    main()
n,k=map(int,input().split())
input()
if n==k:
    print(1)
else:
    print((n+k-2)//(k-1))
import math
N,K = map(int,input().split())
A = list(map(int,input().split()))
index = A.index(1)
ans = math.ceil((N-1-index)/(K-1)) + math.ceil(index/(K-1))

print(ans)
# -*- coding: utf-8 -*-
# モジュールのインポート
import math

# 標準入力を取得
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

# 求解処理
x = A.index(1)
y = N - x - 1
ans = math.ceil(x / (K - 1)) + math.ceil((y - (x % (K - 1))) / (K - 1))

# 結果出力
print(ans)
n, k = map(int, input().split())
a = list(map(int , input().split()))
idx = a.index(1)
l = idx + 1
r = n - idx
print(max(0,l // (k-1)) + max(0,r // (k-1)))
n,k=map(int,input().split())
a=map(int,input().split())
ans=0
while n>0:
  ans+=1
  n-=k
  n+=1
print(ans)
n, k = map(int, input().split())
A = list(map(int, input().split()))

part = []
ln = 0
for a in A:
  if a == 1:
    if ln > 0:
      part.append(ln)
      ln = 0
  else:
    ln += 1
else:
  if ln > 0: part.append(ln)

ans = 0
for p in part:
  ans += (p + 1) // 2

print(ans)
N, K = map(int, input().split())
S = map(int, input().split())

print(int(N / (K - 1)))
n, k = map(int,input().split())
print(n//(k-1) + 1)
n, k = list(map(int, input().split()))
a = input()
left = a.index('1')
right = n -left -1
b = k-1
p1 = (left+1)//b + (right+1)//b
p2 = 1 + left//b + right//b
print(min(p1, p2))
n,k=map(int,input().split())
a=list(map(int,input().split()))
m=1000000
for i in range(n):
  if a[i]==1:
    x=i+1

b=x-1
c=n-x
ans=0
if b%(k-1)==0:
  ans+=b//(k-1)
else:
  ans+=b//(k-1)+1
if c%(k-1)==0:
  ans+=c//(k-1)
else:
  ans+=c//(k-1)+1
print(ans)
n, k = map(int, input().split())
a = list(map(int, input().split()))
idx = a.index(1)
if idx == 0:
    print(-(-len(a[(idx + 1):]) // (k - 1)))
elif idx == (n - 1):
    print(-(-len(a[:idx]) // (k - 1)))
else:
    print(-(-n // (k - 1)))
import math
n, k = map(int,input().split())
a = list(map(int,input().split()))
ans = math.floor(n//(k-1))
print(ans)
n, k = map(int, input().split())
As = list(map(int, input().split()))
ind = As.index(1)
f=0
b=0
nf = 0
nb = 0
while f < n-ind:
  nf += 1
  f += k-1
while b < ind:
  nb +=1
  b += k-1
print(nf + nb)
N, K = map(int, input().split())
A = list(map(int, input().split()))

idx = A.index(1)
L = idx // (K - 1) + (idx % (K - 1) != 0)
R = (N - 1 - idx) // (K - 1) + ((N - 1 - idx) % (K - 1) != 0)
print(L + R)
n, k = map(int, input().split())
a = list(map(int, input().split()))
if n == k:
    print(1)
elif (n - k) % (k - 1) == 0:
    print((n - k) / (k - 1) + 1)
else:
    print((n - k) // (k - 1) + 2)
n, k = map(int, input().split())
a = list(map(int, input().split()))

one = 0
for i in range(n):
    if a[i] == 1:
        one = i + 1
        break
    
front = -(-(one - 1) // (k - 1))
back = -(-(n - one) // (k - 1))
#print(front, back)
print(front + back)
import math

N, K = map(int, input().split())
A = list(map(int, input().split()))
mi_index = A.index(min(A))
left_count = math.ceil(mi_index / (K - 1))
right_count = math.ceil((N - (mi_index + 1)) / (K - 1))

print(left_count + right_count)
Len, Split = map(int, input().split())
_res = Len % (Split - 1)
if _res:
    print(int((Len / (Split - 1))) + 1)
else:
    print(int((Len / (Split - 1))))
import math

def main():
    N, K = map(int, input().split())
    input()
    print(math.floor(N/(K-1)))

main()
Len, Split = map(int,input().split())
Nums = map(int,input().split())
print(Len/(Split-1))
N, K = map(int, input().split())
A = [int(x) for x in input().split()]
ans = 1
if N == K:
    print(1)
    exit()
else:
    ans += (N-K+1)//K+1
print(ans)
N, K = map(int, input().split())
A = list(map(int, input().split()))

if N % (K-1) != 0:
    if N == K:
        ans = 1
    else:
        ans = (N // (K-1)) + 1
else:
    if N == K:
        ans = 1
    else:
        ans = N // (K-1)

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

index = A.index(1)
ans = 0
right = N-1-index
left = index

def judge(value,k,ans):
    if value%k == 0:
        return  value//k
    else:
        return  value//k+1

ans += judge(right,K-1,ans)
ans += judge(left,K-1,ans)


print(ans)
n,k=map(int,input().split())
a = list(map(int,input().split()))
cnt = 0
while n > 0:
  n = n - (k-1)
  cnt +=1
  
print(cnt)
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy

def main():
    n,k = map(int, input().split())
    a_list = list(map(int, input().split()))
    if n == k:
        print(1)
    else:
        print((n//k) + 1)


if __name__ == "__main__":
    main()
import math

n, k = map(int, input().split())
a = [int(i) for i in input().split()]
idx = a.index(1)
l = math.ceil(idx / (k - 1))
r = math.ceil((n - idx - 1) / (k - 1))
print(1 if n == k else l + r)
from math import ceil
n,m = map(int, input().split())
a = list(map(int, input().split()))

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

if min(a) == a[0] or min(a) == a[n-1]:
  print((n+1)//k)
else:
  print((n+1)//k + 1)
n , k = map(int,input().split())
ans = (n-1)//(k-1)+1
print(ans)
n,k=map(int,input().split())
A=list(map(int,input().split()))
b=A.index(1)
print((b-1)//(k-1)+1+(n-b-2)//(k-1)+1)
import math
N,K = map(int,input().split())
A = list(map(int,input().split()))

i = A.index(1)
left = len(A[:i])
right = len(A[i+1:])

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

print(cnt)
N,K = map(int,input().split())
li = [int(i) for i in input().split()]

min_index = li.index(1)
left = min_index
right = len(li) - left - 1

count = 0

if (left > 0) :
    count += left // 2
    if (left % 2 == 1) :
        count += 1

if (right > 0) :
    count += right // 2
    if (right % 2 == 1) :
        count += 1

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

a = A.index(1)

K -= 1

from math import ceil

print(ceil(a / K) + ceil((N - a - 1) / K))
n,k=map(int,input().split())
n=n-k
if n<=k:print(1)
else:
	n=n-k
	r=list(map(int,input().split()))
	print(1+(n+k-2)//(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


if min(left_length,right_length) < k-1:
    if left_length < right_length:
        right_length -= left_length%(k-1)
    else:
        left_length -= right_length%(k-1)


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


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

print(counter)
import math


def main():
    N, K = list(map(int, input().split(' ')))
    A = list(map(int, input().split(' ')))
    index_one = A.index(1)
    min_cnt = N
    for left_index in (index_one - (K - 1), index_one + 1):
        right_index = left_index + (K - 1)
        cnt = math.ceil((left_index + 1) / (K - 1)) + math.ceil((N + 1 - right_index) / (K - 1))
        min_cnt = min([min_cnt, cnt])
    print(min_cnt)


if __name__ == '__main__':
    main()
# 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()
if N == K:
    print(1)
    exit()
A = read_ints()
K -= 1
i = A.index(1)
# コーナーケース対策
if i <= K:
    i = K
elif i >= (N - K):
    i = N - K - 1
right = (i - 1) // K + 1
left = (N - 1 - i - 1) // K + 1


# print(right, left)
print(right + left)
from math import ceil

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

# check
if N == K:
    print(1)
else:
    min_idx = A.index(1)

    if min_idx == 0:
        r_cnt = 0
    else:
        r_cnt = ceil(min_idx / (K - 1))

    if min_idx == N - 1:
        l_cnt = 0
    else:
        l_cnt = ceil((N - min_idx - 1) / (K - 1))

    print(r_cnt + l_cnt)
import sys
N,K = map(int,input().split())
A = list(map(int,input().split()))

#print(A)
count = 0
mn = 10**10
for i in range(0,N-K+2,K-1):
    
    A = A[:i] + [min(A[i:i+K])]*K+A[i+3:]
    count += 1
    if len(list(set(A))) == 1:
        print(count)
        sys.exit()
import math
n,k=map(int,input().split())
a=list(map(int,input().split()))
ind=10**7
ans=0
for i in range(n):
  if a[i]==1:
    ind=i
ans+=math.ceil(ind/(k-1))+math.ceil((n-ind-1)/(k-1))

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

if n == k:
    print(1)
    exit()

print(1 + ((n - k) + 1) // (k-1))
import math

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

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

min_index = a.index(min(a))

left_count = min_index

right_count = n - min_index - 1

print( math.ceil(left_count / (k-1)) + math.ceil(right_count / (k-1)) )
n,m=map(int,input().split())
l=list(map(int,input().split()))
print(-(-((len(l)-m)//(m-1))))
n,k = map(int,input().split())
a = list(map(int,input().split()))
ind_1 = 0

for i in range(n):
    if a[i] == 1:
        ind_1 = i
        break

a_mae = len(a[:ind_1])
a_ato = len(a[ind_1+1:])

print(-(-a_mae//(k-1))-(-a_ato//(k-1)))
#C - Minimization
N,K = map(int, input().split())
A = list(map(int, input().split()))
tmp = 0
# for i in range(N):
#     if A[i] == 1:
#         tmp = i+1
#         break

if N % K > 0:
    ans = N//K +N//K
else:
    ans = N//K
print(ans)
import math
N, K = list(map(int,input().split()))
A = list(map(int,input().split()))
for i in range(N):
    if A[i] == 1:
        ind = i
        break
left = ind
right = N - ind - 1
ans = math.ceil(left / (K - 1)) + math.ceil(right / (K - 1))
print(ans)
n, k = map(int, input().split())
a = list(map(int, input().split()))

ans = n//k
mod = (n-k)//(k-1) + min((n-k)%(k-1), 1)
print(ans + mod)
n,k=map(int,input().split())
a = list(map(int,input().split()))
cnt = 0

if n == k:
  cnt = int(n / k)
else:
  while n > 0:
    n = n - (k-1)
    cnt +=1
  
print(cnt)
n,k = map(int,input().split())
a = [int(i) for i in input().split()]
if n == k:
    print(1)
else:
    b = a.index(1) 
    if b < k-1:
        b +=1
    if b > (n-1) -k-1:
        b -=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)
n, k = map(int, input().split())
As = list(map(int, input().split()))

if n == k:
    print(1)
    exit()
for i in range(10000):
    if i * (k - 1) + k < n and n == (i + 1) * (k - 1) + k:
        print(i+1)
    elif i * (k - 1) + k < n and n < (i + 1) * (k - 1) + k:
        print(i+2)
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 and rem != 0 or d != 0:
    ans -=1
print(ans)
a,b = map(int,input().split())
c = input()
print((a+b-1)//b)
n,k=map(int,input().split())
a=[int(i) for i in input().split()]
i=a.index(1)
print((i+(k-1)-1)//(k-1)+(n-(i+1)+(k-1)-1)//(k-1))
N, K = map(int, input().split())
A = list(map(int, input().split()))

idx = 0
for i in range(N):
  if A[i] == 1:
    idx = i
    break

ans = 0
# Left
if (N-(idx+K)) % (K-1) == 0:
  ans += (N-(idx+K))//(K-1)+1
else:
  ans += (N-(idx+K))//(K-1)+1+1

# Right
if (idx-(K-1)) % (K-1) == 0:
  ans += (idx-(K-1))//(K-1)+1
else:
  ans += (idx-(K-1))//(K-1)+1+1
print(ans)
# 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()
if N == K:
    print(1)
    exit()
A = read_ints()
K -= 1
i = A.index(1)
# コーナーケース対策
if i < K:
    i = K
elif i >= (N - K):
    i = N - K - 1
right = (i - 1) // K + 1
left = (N - 1 - i - 1) // K + 1


# print(right, left)
print(right + left)
n=input().rstrip().split()
preans=int(n[0])/int(n[1])
ans=int(preans)+1
print(ans)
n, k = map(int, input().split())
As = list(map(int, input().split()))

if n == k:
    print(1)
    exit()
for i in range(10):
    # print(i * (k - 1) + k)
    # print((i + 1) * (k - 1) + k)
    if i * (k - 1) + k < n and n <= (i + 1) * (k - 1) + k:
        print(i+2)
import sys
import math

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

if alist[0] == 1 or alist[-1] == 1:
    print(math.ceil((n-1)//(k-1)))
    sys.exit()

for i in range(n):
    if alist[i] == 1:
        mini=i
        sho=i
        dai=n-i-1
        break

shomod=sho%(k-1)
daimod=dai%(k-1)

if shomod + daimod <= k-1 :
    print(sho//(k-1) + dai//(k-1)+1)
else:
    print(sho//(k-1) + dai//(k-1)+2)
N, K = map(int, input().split())
print((N-1)//(K-1)+1)
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from math import ceil
def main():
    n, k, *a = map(int, read().split())
    if n <= k:
        print(1)
        sys.exit()
    pos = a.index(1)
    mae = ceil(pos / (k - 1))
    ushiro = ceil((n - 1 - pos) / (k - 1))
    r = mae + ushiro
    print(r)

if __name__ == '__main__':
    main()
n,k,*_=map(int,open(0).read().split())
print(~-n//~-k)
n,m=map(int,input().split())
l=list(map(int,input().split()))
print(-(-int((len(l)-m)//(m-1))))
import math
n, k  = [int(i) for i in input().split()]
nums = [int(i) for i in input().split()]

if n == k:
    print(1)
else:
    print(math.ceil(n/(k-1)))
n, k = 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()))

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

ans = 0

k -= 1

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

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

print(ans)
n, k = map(int, input().split())
print(n // (k - 1) + (0 if n % (k - 1) == 0 else 1))
n,k=map(int,input().split())
a=list(map(int,input().split()))
if n==k:
    print(1)
    exit()
i=n-k+1
ans=1
while i>0:
    i=i-k+1
    ans+=1
print(ans)
nk = list(map(int,input().split()))
A = list(map(int,input().split()))
n = nk[0]
k = nk[1]
for i in range(n):
  if A[i] == 1:
    index = i
lef = index
rig = n -lef - 1
if lef % (k-1)== 0:
  lefs = lef // (k-1)
else:
  lefs = lef // (k-1) +1
if rig % (k-1)== 0:
  rigs = rig // (k-1)
else:
  rigs = rig // (k-1) +1
ans = rigs + lefs
print(ans)
N, K = map(int, input().split())
A = list(map(int, input().split()))

print(1+(N-K)//(K-1))

cnt = 1
length = K
while True:
    if length >= N:
        print(cnt)
        break
    length += K-1 
    cnt += 1
n,k = map(int,input().split())
a_list = list(map(int,input().split()))
print((n+k)//k)
import math


def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    print(math.ceil((n -1) // (k - 1)))

    
if __name__ == '__main__':
    main()
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy

def main():
    n,k = map(int, input().split())
    a_list = list(map(int, input().split()))
    if n == k:
        print(1)
    else:
        print(ceil(n/k) + 1)

if __name__ == "__main__":
    main()
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)
cnt += math.ceil((N - 1 - now) / 2)
print(cnt)
import sys
input = sys.stdin.readline

def main():
    N, K = [int(x) for x in input().split()]
    A = [int(x) for x in input().split()]

    x = A.index(1)
    l = -(-(x // (K - 1)))
    lmod = (x + 1) % K
    r = -(-(N - x - 1 - lmod) // (K - 1))
    print(l + r)




if __name__ == '__main__':
    main()
Len, Split = map(int, input().split())
_res = Len % (Split-1)

if _res:
    res = int((Len / (Split - 1)) + 1)
    print(res)
else:
    res = int(Len / (Split - 1))
    print(res)
import math

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

if min_index == 0:
    answer = math.ceil((N-min_index)/K)
elif min_index == N-1:
    answer = math.ceil(min_index/K)
else:
    answer = math.ceil((min_index+1)/K) + math.ceil((N-min_index+1)/K)

print(answer)
N,K=map(int,input().split())
x=list(map(int,input().split()))
print(N//K)
if N%K==0:
  print(N//K)
else:
  print(N//K+1)