peterverebics/CodeNet_Python_118 huggingface dataset:
N,K = map(int, input().split())
A=list(map(int,input().split()))

min_num=min(A)
count=A.count(min_num)
target=len(A)-count
K_num=K-1

print(int(-(-target//K_num)))
n,k = map(int, input().split()) 
num_list = list(map(int, input().split()))

if (n-k) % (k-1) == 0:
    print((n-k)//(k-1)+1)
else:
    print((n-k)//(k-1) + 2)
from bisect import bisect_left

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

pos = bisect_left(a, 1)
print((pos + k - 2) // (k - 1) + (n - pos + k - 3) // (k - 1))
n,k = map(int,input().split())
A = list(map(int,input().split()))

print(-((1-n)//(k-1)))
import math
n, k = map(int, input().split())
an = list(map(int, input().split()))
n = n-k
ans = math.ceil(n/(k-1)) + 1
print(ans)
from math import ceil
n, k = [int(x) for x in input().split()]
a_list = [int(x) for x in input().split()]
print(ceil((n - 1) / (k - 1)))
n,k=map(int,input().split())
a=list(map(int,input().split()))
print((n-2)//(k-1)+1)
import math
n,k=map(int,input().split())
a=list(map(int,input().split()))

print(math.ceil((n-1)/(k-1)))
import sys
input = sys.stdin.readline
import math

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

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




if __name__ == '__main__':
    main()
n, k = [ int(i) for i 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 - 2) // (k - 1)
  for i in range(max(i0 - k + 1, 0), min(i0, n - k) + 1) ]))
import math
N, K = map(int, input().split())
a = list(map(int, input().split()))
ans = math.ceil((N - 1)/ (K - 1))
print(ans)
import math
N, K = map(int, input().split())
A = input()
print(math.ceil((N-K)/(K-1))+1)
N,K = list(map(int,input().split()))
A = list(map(int,input().split()))

one = 1
ans = 0

while one < N:
    one += K-1
    ans += 1
    
print(ans)
import math
N,K = map(int,input().split())
A = list(map(int,input().split()))


N -= K

print(math.ceil(N/(K-1))+1)
n, k = map(int,input().split())
a = [int(i) for i in input().split()]

if n == k:
    cnt = 1
else:
    cnt = (n - 2) // (k-1) + 1
print(cnt)
def main():
  n, k = map(int, input().split())
  m = 1 + (n - k) // (k - 1)
  if (n - k) % (k - 1) == 0:
    print(m)
  else:
    print(m + 1)
if __name__=="__main__":
  main()
from math import ceil

n, k = map(int, input().split())
a = list(map(int, input().split()))
print(1 + ceil((n - k) / (k - 1)))
n, k = map(int, input().split())
lst = list(map(int, input().split()))
idx = lst.index(1)
k -= 1
a = (len(lst[:idx]) + k - 1) // k
b = (len(lst[idx + 1:]) + k - 1) // k
c = ((n - 1) + k - 1) // k
print(min(c, a + b))
n,k=map(int,input().split())
i=1
cnt=0
while i<n:
  i+=k-1
  cnt+=1
print(cnt)
from math import ceil
n,k=map(int,input().split())
print(ceil((n-1)/(k-1)))
N, K = map(int, input().split())
A = list(map(int, input().split()))

ans = 0

tmp = len(A)

while True:
    tmp -= K
    ans += 1
    if tmp <= 0:
        break
    else:
        tmp += 1

print(ans)
n, k = map(int,input().split())
a = list(map(int,input().split()))
print((n-k-1)//(k-1)+2)
N,K = map(int,input().split())
print((N+K-3)//(K-1))
import math
n, k, *nums = map(int, open(0).read().split())
print(math.ceil((n-k)/(k-1))+1)
import math
N, K = map(int, input().split())
A = list(map(int, input().split()))

a = math.ceil(A.index(1)/(K-1))
b = math.ceil((N-a*(K-1))/(K-1))
ans = min(a+b, math.ceil((N-1)/(K-1)))
print (ans)
N,K = map(int,input().split())
A = list(map(int,input().split()))
from math import ceil
print(ceil((N-1)/(K-1)))
n,k=map(int,input().split())
a=map(int,input().split())
ans=0
while n>1:
  ans+=1
  n-=k
  n+=1
print(ans)
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n, k = nm()
    A = nl()
    print((n - 1) // (k - 1) if (n - 1) %
          (k - 1) == 0 else (n - 1) // (k - 1) + 1)


if __name__ == '__main__':
    main()
n, k = map(int, input().split())
a = [int(i) for i in input().split()]
print(1 if n <= k else 1 + -(-(n - k) // (k - 1)))
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 range(index_one - (K - 1), index_one + 1):
        right_index = left_index + (K - 1)
        if left_index < 0 or right_index > N - 1:
            continue
        cnt = 1 + math.ceil(left_index / (K - 1)) + math.ceil((N - 1 - right_index) / (K - 1))
        min_cnt = min([min_cnt, cnt])
    print(min_cnt)


if __name__ == '__main__':
    main()
import bisect
N,K = map(int,input().split())
A = list(map(int,input().split()))
if N==K: print(1);exit()
N-=K
ans = 1
while N>0:
    N -=K-1
    ans += 1
print(ans)
import math
n,k=map(int,input().split())
a=list(map(int,input().split()))
"""
すべて1にする
"""
print(math.ceil((n-k)/(k-1))+1)
import math
n,k = map(int,input().split())
l = list(map(int,input().split()))
if k >= n:
  print(1)
  exit()
n -= k
print(math.ceil(n/(k-1))+1)
N, K = map(int, input().split())
A = list(map(int, input().split()))
cnt = 0
B = N - K
cnt += 1
if B % (K-1) == 0:
    cnt += B // (K-1)
else:
    cnt += B // (K-1)
    cnt += 1
print(cnt)
n,k=map(int,input().split())
a=[int(x) for x in input().split()]
ans=1
n-=k
k-=1
ans+=(n+k-1)//k
print(ans)
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n, k = MI()
    a = LI()
    ans = -(-(n-1) // (k-1))
    print(ans)

if __name__ == '__main__':
    main()
#!/usr/bin/env python3
n, k = map(int, input().split())
print(0--~-n//~-k)
import math

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

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

print(answer)
n, k = map(int, input().split())
a = list(map(int, input().split()))
if n==k:
  print(1)
else:
  print((n+k-3)//(k-1))
import math
def main():
    N, K = map(int, input().split())
    A = [int(a) for a in input().split()]

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

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


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

print(ans)
NK = list(map(int, input().split()))
no = list(map(int, input().split()))

zan = NK[0]
counter = 0
while(NK[1] < zan):
    zan -= NK[1] - 1
    counter += 1

print(counter + 1)
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 - 3) // (K - 1))

    return


if __name__ == '__main__':
    main()
n,k=map(int,input().split())
a=list(map(int,input().split()))
n-=k
k-=1
count=1

if n<=0:
  pass
else:
  while n>0:
    n-=k
    count+=1
    
print(count)
import math
N, K = map(int, input().split())
A = list(map(int, input().split()))
print(math.ceil((N - 1) / (K - 1)))
from math import ceil
n,k = map(int,input().split())
a = list(map(int,input().split()))
print(ceil((n-1)/(k-1)))
#import collections
#aa = collections.Counter(a) # list to list
#from itertools import combinations # (string,3) 3回

mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n,k = readInts()
    A = readInts()
    import math
    nokori = n - k
    #print(nokori)
    cnt = 1
    cnt += math.ceil(nokori/(k-1))
    print(cnt)




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

def solve():
    N,K = map(int, input().split())
    A = map(int, input().split())
    
    print(math.ceil((N-1)/(K-1)))
    
solve()
n,k = map(int,input().split())
lst = list(map(int,input().split()))

id = lst.index(1)

left = len(lst[0:id])
right = len(lst[id+1:])
mod = max(left%(k-1),right%(k-1))

total = left + right

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

print(counter)
N,K = (map(int , input().split()))
A = list(map(int , input().split()))
con = 0
ans = 0
iti = 1
ans = K-1 + iti
while N > ans:
    ans += K-1
    con += 1
print(con+1)
n,k = map(int, input().split())
A = list(map(int, input().split()))
counter = 0

for i in range(0,n,k-1):
  min_n = min(A[i:i+k])
  max_n = max(A[i:i+k])
  if min_n != max_n:
    counter += 1
  if i+k-1 < n:
    A[i+k-1] = min_n
  
print(counter)
x,y = map(int,input().split())

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

if x-y <= 0:
    print(1)
    exit()
else:
    x -= y

if x%(y-1)!=0:
    print(2+x//(y-1))
else:
    print(1+x//(y-1))
n,k = [int(i) for i in input().split()]
an = input()
count = 1
n -= k
k -= 1
while(n > 0):
    n -= k
    count += 1
print(count)
n,k=map(int,input().split())
a=list(map(int,input().split()))

ans=1
n-=k

while n>0:
    n-=(k-1)
    ans+=1
print(ans)
import math

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

print(math.ceil((n-1)/(k-1)))
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

print((N - 2) // (K - 1) + 1)
n, k = map(int, input().split())
if (n - k) % (k - 1) == 0:
    print(1 + (n - k) // (k - 1))
else:
    print(1 + (n - k) // (k - 1) + 1)
n,k = map(int, input().split())

x=(n-k)//(k-1)
y=(n-k)%(k-1)

if y==0:
    print(x+1)
else:
    print(x+2)
n, k = map(int, input().split())
a = list(map(int, input().split()))

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

l=n-k
r=k-1
if l%r==0:
  print(l//r+1)
else:
  print(l//r+2)
# solution

nim,mike=map(int,input().split())

array=[int(x) for x in input().split()]

print((nim+mike-3)//(mike-1))
import math
n,k = map(int,input().split())
s = input()
print(math.ceil((n-1)/(k-1)))
import math

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

print(math.ceil((n-1)/(k-1)))
n, k, *a = map(int, open(0).read().split())
print((n+k-3)//(k-1))
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()
i = A.index(1)
ans = 10**9
for j in range(K):
    ans = min(ans,math.ceil(max(i-j,0)/(K-1))+math.ceil(min((N-i-1+j),N-1)/(K-1)))
print(ans)
n,k = map(int, input().split())
a = list(map(int, input().split()))

t=k
ans=1
while t < n:
  t+=k-1
  ans+=1
print(ans)
N,K = map(int,input().split())
A = list(map(int,input().split()))
import math
print(math.ceil((N-1)/(K-1)))
N, K = map(int, input().split())
A = list(map(int, input().split()))

ans = 1
tmp = N - K
ans += tmp // (K - 1)

if tmp%(K - 1) != 0:
    ans += 1

print(ans)
import math
n, k = map(int, input().split())
a_list = list(map(int, input().split()))
print(math.ceil((n - 1) / (k - 1)))
def resolve():
    import math
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    print(math.ceil((N-1)/(K-1)))
resolve()
import math
n,k = map(int,input().split())
A = list(map(int,input().split()))
print(int(math.ceil((len(A)-k)/(k-1)))+1)
import math

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

ans = 0

ans = math.ceil((n-1)/(k-1))
print(ans)
n,k = map(int,input().split())
count = 1
n = n-k

while 0<n:
  n = (n+1) - k
  count = count + 1
  
print(count)
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)
import math
n,k=map(int,input().split())
a=[int(x) for x in input().split()]

print(math.ceil((n-1)/(k-1)))
a,b = map(int,input().split())
c = input()
print((a+b-3)//(b-1))
import math
n, k = map(int,input().split())
input()
print(math.ceil((n-1)/(k-1)))
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

print((n - 1 + k - 2) // (k - 1))
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()

print((N+K-3)//(K-1))
import math
N, K = map(int, input().split())
A_list = [int(i) for i in input().split()]

print(math.ceil((N-1)/(K-1)))
n,k = map(int,input().split())
print((n-1+(k-2))//(k-1))
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:
    
    ans+=1
    now+=k-1
print(ans)
import math
n,k = map(int,input().split())
a = list(map(int,input().split()))
m = a.index(1)
ans = 9999999999
left = len(a[:m])
right = len(a[m:])
for i in range(k):
    x = left  - i
    y = right - (k-i)
    if x < 0 or y < 0:
        continue
    count = 1 + math.ceil(x/(k - 1)) + math.ceil(y/(k - 1))
    ans = min(ans,count)
print(ans)
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()))
    print(ceil((n-1)/(k-1)))

if __name__ == "__main__":
    main()
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, K = lr()
A = lr()
answer = -(-(N-1)//(K-1))
print(answer)
import math
N, K = list(map(int,input().split()))
A = list(map(int,input().split()))

print(math.ceil((N-1)/(K-1)))
# coding: utf-8
from math import ceil
N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
cnt = 1
for i in range(1, N):
    if A[0] == A[i]:
        cnt += 1
print(ceil((N-cnt)/(K-1)))
import sys
def input(): return sys.stdin.readline().rstrip()

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

    K -= 1
    a1_i = A.index(1)
    left = (a1_i + K - 1) // K
    right = (N - 1 - (left * K) + K - 1) // K
    print(left + right)

if __name__ == '__main__':
    main()
n, k = map(int, input().split())
a = [int(x) for x in input().split()]
minimum = 10**9
index = -1
for i in range(n):
  if minimum > a[i]:
    index = i
    minimum = a[i]
ans = 1+(i-1)//(k-1)+(n-i-1)//(k-1)
print(ans)
N, K = map(int, input().split())
A = [int(x) for x in input().split()]

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

for i in range(n+10):
    if k*i-(i-1)>=n:
        print(i)
        break
import math

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

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

print(ans)
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()
    else:
        r = ceil((n - 1) / (k - 1))
        print(r)
if __name__ == '__main__':
    main()
n,k=map(int,input().split())
a=list(map(int,input().split()))
print(-(-(n-k)//(k-1))+1)
N, K = map(int, input().split())
A = [int(x) for x in input().split()]

print((N+K-3)//(K-1))
N, K = [int(i) for i in input().split()]

array = [int(i) for i in input().split()]

n = N - K 

q, r = divmod(n, (K-1))
if r == 0:
    print(q + 1)
else :
    print(q + 2)
import math

def read_ints():
    return[int(i) for i in input().split()]

def main():
    n, k = read_ints()
    print(math.ceil((n - 1) / (k - 1)))

if __name__ == '__main__':
    main()
from math import ceil
n,k = map(int, input().split())
a = list(map(int, input().split()))

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

N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

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

ans = (n-1) // (k-1)
if (n-1) % (k-1) > 0: ans += 1
print(ans)
S = input().split(" ")
N = int(S[0])
K = int(S[1])
ARR = input().split(" ")



def calculate(n,k):
    counts = 0
    while n > 0:
        if n == k:
            counts += 1
            break
        n = n - (k - 1)
        counts += 1
    return counts
result = calculate(N,K)

print(result)
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)
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())
alist=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())

q = (n-1) // (k-1)
r = (n-1) % (k-1)

if r: print(q+1)
else: print(q)
n,k = map(int, input().split())
x=(n-k)//(k-1)
y=(n-k)%(k-1)
print(x+1) if y==0 else print(x+2)
n, k = map(int, input().split())
A = list(map(int, input().split()))
if (n-k) % (k-1) == 0: print(1 + (n-k) // (k-1))
else: print(1 + (n-k) // (k-1) + 1)
#101_C
N,K=map(int,input().split())
A=list(map(int,input().split()))
print(-(-(N-1)//(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//(K-1)
Left -= ((K-1)-Right%(K-1))%(K-1)
Count += (Left%(K-1)!=0)+Left//(K-1)
print(Count)
n,k=map(int,input().split())
a=list(map(int,input().split()))
x=a.index(1)
#print(x)

if n==k:
    print(1)
else:
    #if x<=k-1 or x>=n-k:
    if (n-k)%(k-1)==0:
        ans=1+(n-k)//(k-1)
    else:
        ans=1+(n-k)//(k-1)+1


    print(ans)
# coding: utf-8
N,K=map(int,input().split())
A=list(map(int,input().split()))

ans=-(-(N-1)//(K-1))

print(ans)
n,k=map(int,input().split())
print((n-1+k-2)//(k-1))
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()))
n-=1
k-=1
if n%k==0: print(n//k)
else: print(n//k+1)
N, K = map(int, input().split())
A = list(map(int, input().split()))
print(1+(N-2)//(K-1))
n, k = map(int,input().split())
a = list(map(int,input().split()))
num = k
ans = 1
while num < n:
    num += k-1
    ans += 1
print(ans)
n,k=map(int,input().split())
A=list(map(int,input().split()))
import math
print(math.ceil((n-1)/(k-1)))
import math
n, k = map(int, input().split())
a = list(map(int, input().split()))
print(math.ceil((n-1)/(k-1)))
import math

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

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

print(ans)
import sys
input = sys.stdin.readline

def main():
	N,K=map(int,input().split())
	A=list(map(int,input().split()))
	if (N-1)%(K-1):
		print((N-1)//(K-1)+1)
	else:
		print((N-1)//(K-1))
if __name__=='__main__':
	main()
import math
total = 0
N,M = list(map(int,input().split()))
M = M-1
n_l = "".join(input().split())
A = n_l.find("1")
before = A
after = N-A-1
while before > 0:
    before-=M
    total +=1
if before < 0:
    before = abs(before)
    after -= before
while after > 0:
    after-=M
    total +=1
print(total)
n,k=map(int,input().split())
lst=list(map(int,input().split()))
import math
p=len(lst)
p-=k
ans=1
ans+=math.ceil(p/(k-1))
print(ans)
N, K = map(int, input().split())
A = list(map(int, input().split()))
N -= K
K -= 1
ans = 1
ans += (N-1)//K + 1
print(ans)
def main():
    from math import ceil
    n, k, *a = map(int, open(0).read().split())
    i = a.index(1)
    ans = 1 + ceil((n - k) / (k - 1))
    print(ans)


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

N,K = (int(x) for x in input().split())
A = list(map(int, input().split()))
if N == K:
    print('1')
else:
    print(math.ceil((N-1)/(K-1)))
N, K = map(int, input().split())
A = list(map(int, input().split()))

# 並び順を変えても普遍
ans = 0
i = 0

while True:
    if i*(K-1) >= N-1:
        break
    ans += 1
    i += 1
    
print(ans)
import math
n,k = map(int,input().split())
a = list(map(int,input().split()))
print(math.ceil(((n-k)/(k-1)))+1)
from math import ceil
n, k = map(int, input().split())
A = list(map(int, input().split()))
print( ceil((n-1)/(k-1)) )
import math
# def resolve():
# 	n, k = map(int, input().split())
# 	a = list(map(int, input().split()))
# 	i = a.index(min(a)) + 1
# 	if k - 1 > i:
# 		v = max(0, math.ceil((n - k - 2) / (k - 1))) + 1
# 	else:
# 		v = math.ceil(i / (k - 1)) + math.ceil((n - i - 1) / (k - 1))
# 	print(v)

def resolve():
	n, k = map(int, input().split())
	a = list(map(int, input().split()))
	v = math.ceil((n - k) / (k-1) + 1)
	print(v)
resolve()
import math
a,b = map(int,input().split())
l = sorted(list(map(int,input().split())))

ans = math.ceil((a-1) / (b-1))
print(ans)
import sys
import math

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

ans = math.ceil((N - 1) / (K-1))
print(ans)
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())

print(math.ceil((N-1)/(K-1)))
from math import ceil
N,K = map(int,input().split())
A = list(map(int,input().split()))
#mini = A.index(1)
print(ceil((N-K)/(K-1))+1)
n, k = map(int, input().split())
lst = list(map(int, input().split()))

n -= 1
k -= 1
  
print(-(-n // k))
N,K=map(int,input().split())
A=list(map(int,input().split()))
result=-(-(len(A)-1)//(K-1))
print(result)
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) / (k - 1)) + 1)
N, K = map(int, input().split())
A = list(map(int, input().split()))

ans = 1 + (N - K) // (K - 1)
if (N - K) % (K - 1) != 0:
    ans += 1
print(ans)
def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    N -= K
    if N <= 0:
        return 1
    return 1 + (N + K - 2) // (K - 1)

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

ans = math.ceil((N-1)/(K-1))
print(ans)
## n-1 + k-1 -1 = n+k-3が正しい
n,k = map(int,input().split( ))
print((n+k-3)//(k-1))
n,k = map(int,input().split())
input()
print(-((1-n)//(k-1)))
N, K = map(int, input().split())
Ax = list(map(int, input().split()))
if N == K:
    print(1)
    exit()

N -= K
ans = 1

while N > 0:
    N = N-(K-1)
    ans += 1

print(ans)
import math
N, K = list(map(lambda k: int(k), input().split(" ")))
A = list(map(lambda a: int(a), input().split(" ")))

pos_of_1 = A.index(1)

if K >= pos_of_1 + 1 or N - K <= pos_of_1:
  print(math.ceil((N - K) / (K - 1)) + 1) 
else:
  L = A[:pos_of_1 + 1]
  R = A[pos_of_1:]
  res = []
  for i in range(1, K):
    l = math.ceil((len(L) - i) / (K - 1)) + 1
    r = math.ceil((len(R) - K - 1 + i) / (K - 1)) + 1
    res.append(l + r - 1)
  print(min(res))
import sys
import math

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

print(math.ceil((n-1)/(k-1)))
import math

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

if K == N:
  print(1)
else:
  print(math.ceil((N - K) / (K - 1)) + 1)
n, k = map(int, input().split())
print((n - 1) // (k - 1) + (0 if (n - 1) % (k - 1) == 0 else 1))