Problem:
 Score : 300 points    Problem Statement There is a sequence of length N : A_1, A_2, ..., A_N . Initially, this sequence is a permutation of 1, 2, ..., N .  On this sequence, Snuke can perform the following operation:   Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.   Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times.
Find the minimum number of operations required.
It can be proved that, Under the constraints of this problem, this objective is always achievable.      Constraints  2 \leq K \leq N \leq 100000  A_1, A_2, ..., A_N is a permutation of 1, 2, ..., N .         Input Input is given from Standard Input in the following format:  N  K  A_1  A_2  ...  A_N       Output Print the minimum number of operations required.        Sample Input 1 4 3
2 3 1 4      Sample Output 1 2  One optimal strategy is as follows:    In the first operation, choose the first, second and third elements. The sequence A becomes 1, 1, 1, 4 .    In the second operation, choose the second, third and fourth elements. The sequence A becomes 1, 1, 1, 1 .         Sample Input 2 3 3
1 2 3      Sample Output 2 1       Sample Input 3 8 3
7 3 1 8 4 6 2 5      Sample Output 3 4

Solution (Python):

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

Solution (Python):
N, K = map(int, input().split())

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

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

print(ans)

Solution (Python):
N,K = [int(i) for i in input().split()]
print((N-K)//(K-1) + 1 if (N-K)%(K-1) == 0 else (N-K)//(K-1) + 2)

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

Solution (Python):
N,K = [int(i) for i in input().split()]
n = list(map(int, input().split()))
print((len(n)-K)//(K-1) + 1 if (len(n)-K)%(K-1) ==0 else (len(n)-K)//(K-1) + 2)

Solution (Python):
import math

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

Solution (Python):
n,k=map(int, input().split())
a=sorted(list(map(int, input().split())))

if n%k!=0:
    for _ in range(n%k):
        a.append(10**6)

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

print(ans)

Solution (Python):
import sys
from collections import deque
from functools import reduce
import copy
import math


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    [N, K] = string_to_int(inputs[0])
    paint_range = K-1
    A = string_to_int(inputs[1])
    one_index = None

    for i, a in enumerate(A):
        one_index = i if a == 1 else one_index
    count = one_index // paint_range
    r = one_index % paint_range
    over = 0
    if r != 0:
        count += 1
        over = paint_range - r
    count += math.ceil(((N-1) - one_index - over) / paint_range)
    return count


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(2))
    print(ret)

Solution (Python):
import math

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

    j = 0
    for i in range(N):
        if A[i] == 1:
            j = i
            break
    min_v = float('inf')
    for i in range(j, j-K, -1):
        v = 1 + math.ceil(max(i, 0)/(K-1)) + math.ceil(max(0, N-K-i)/(K-1))
        min_v = min(min_v, v)
    return min_v

if __name__ == '__main__':
    print(main())

Solution (Python):

import sys
import math

def solve(N: int, K: int, A: "List[int]"):

    ans = math.ceil((N-1)/(K-1))
    print(ans)

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    K = int(next(tokens))  
    A = [int(next(tokens)) for _ in range(N)]  
    solve(N, K, A)

if __name__ == '__main__':
    main()

Solution (Python):

import sys
import math

def solve(N: int, K: int, A: "List[int]"):
    ix = A.index(1)

    ans = math.ceil((N-1)/(K-1))
    print(ans)


    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    K = int(next(tokens))  
    A = [int(next(tokens)) for _ in range(N)]  
    solve(N, K, A)

if __name__ == '__main__':
    main()

Solution (Python):

import sys
import math

def solve(N: int, K: int, A: "List[int]"):
    ix = A.index(1)

    
    
    

    
    
    

    ans = math.ceil((N-1)/(K-1))
    print(ans)


    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    K = int(next(tokens))  
    A = [int(next(tokens)) for _ in range(N)]  
    solve(N, K, A)

if __name__ == '__main__':
    main()

Solution (Python):
import math

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

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

Solution (Python):
N, K = [int(s) for s in input().split()]
print(1 -(-(N-K)//(K-1)))

Solution (Python):
import math

N, K = map(int, input().split())
nums = list(map(int, input().split()))
print(math.ceil((len(nums)-1)/(K-1)))

Solution (Python):
import math
def solve():
  n,k = (int(i) for i in input().split())
  a = list(int(i) for i in input().split())
  ct = 1
  n -= k
  if n>0:
    ct += math.ceil(n/(k-1))
  print(ct)
solve()

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

if N == K:
    print(1)
else:
    tmp = N - K
    ans = 1 + tmp // (K-1)

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

Solution (Python):
n, k = map(int, input().split())
l = list(map(int, input().split()))

ans = 0
i = 0
while i < n-1:
  i += k-1
  ans += 1
print(ans)

Solution (Python):
n,k=map(int,input().split())
a=list(map(int,input().split()))
one=a.index(1)
left=one
right=n-(one+1)

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

Solution (Python):
n, k = map(int,input().split())
a = list(map(int,input().split()))
one_index = a.index(1)
ans = 10 ** 6
for i in range(one_index - (k-1) ,one_index + (k-1) + 1 ):
    l = i
    r = i + (k-1)
    cnt_l = 0
    cnt_r = 0
    if l >= 0:
        if l % (k-1) == 0:
            cnt_l = l // (k-1)
        else:
            cnt_l = l // (k-1) + 1
        
    if r < n:
        if (n-1-r) % (k-1) == 0:
            cnt_r = (n-1-r) // (k-1)
        else:
            cnt_r = (n-1-r) // (k-1) + 1
    ans = min(ans, 1 + cnt_l + cnt_r)
print(ans)

Solution (Python):
N,K=map(int,input().split())
A=input()
import math
print(math.ceil((N-1)/(K-1)))

Solution (Python):
n,k=map(int,input().split())
a=input()
x=(n-1)/(k-1)
if x==int(x):
    print(int(x))
else:
    print(int(x)+1)

Solution (Python):
import math
n,k = map(int,input().split())
a = [int(i) for i in input().split()]
print(math.ceil((n-1)/(k-1)))

Solution (Python):
import math

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

    print(math.ceil((N - 1) / (K - 1)))

main()

Solution (Python):
N, K = [int(_) for _ in input().split()]

A = [int(_) for _ in input().split()]

m = min(A)

i = 0
ans = 0
while i < N:
    if i ==0:
        i+=K
    else:
        i += K - 1
    ans += 1
print(ans)

Solution (Python):
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)

Solution (Python):
def main():
  n, k = map(int,input().split())

  print((n - 2) // (k - 1) + 1)

main()

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

ans = -(-(n-1)//(k-1))

print(ans)

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

div, mod = divmod(N - 1, K - 1)
if mod == 0:
    print(div)
else:
    print(div + 1)

Solution (Python):
import os,re,sys,operator,math
from collections import Counter,deque
from operator import itemgetter
from itertools import accumulate,combinations,groupby
from sys import stdin,setrecursionlimit
from copy import deepcopy
import heapq

setrecursionlimit(10**6)

n,k=map(int,stdin.readline().rstrip().split())
a=[int(i) for i in stdin.readline().rstrip().split()]
print(math.ceil((n-1)/(k-1)))

Solution (Python):
import math

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

left_opes = math.ceil(min_index / (K - 1))
left_index = left_opes * (K - 1)

right_opes = math.ceil((N - 1 - left_index) / (K - 1))

print(left_opes + right_opes)

Solution (Python):
n,k = map(int,input().split())
a = [int(i) for i in input().split()]

idx = 0

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

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

print((n-1+k-2)//(k-1))
exit()
ans = (n-idx+k-2)//(k-1) + (idx+k-2)//(k-1)

for i in range(k-1):
    ans = min(ans,  (n-idx+k-2-1-i)//(k-1) + (idx+k-2-(k-2-i))//(k-1) + 1)
print(ans)

Solution (Python):
n, k = map(int, input().split())
d = k - 1
print((n + d - 2) // d)

Solution (Python):
import math

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

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

print(math.ceil((N - K) / (K - 1)) + 1)

Solution (Python):
from math import ceil
N,K = map(int,input().split())
alist = list(map(int,input().split()))

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

Solution (Python):
import itertools
import collections

def getint(): return int(input())
def getints(): return list(map(int, input().split()))

n,k = getints()
a = getints()


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

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

def ceil(x, y) :
    return (x + y - 1) // y

ans = ceil(N - K, K - 1) + 1
print(ans)

Solution (Python):
N,K=map(int,input().split())
A=list(map(int,input().split()))
if (N-1)%(K-1)>0:
    print((N - 1) // (K - 1) + 1)
else:
    print((N-1)//(K-1))

Solution (Python):
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)

Solution (Python):
import math
n,k=map(int,input().split())
a=list(map(int,input().split()))
print(math.ceil((n-k)/(k-1)+1))

Solution (Python):
n,k = map(int,input().split())
a = list(map(int,input().split()))
for i in range(n):
  if a[i] == 1:
    one = i
print( (i-1)//(k-1) + (n-i-2)//(k-1) + 2 )

Solution (Python):
import math

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

Solution (Python):
N, K = map(int,input().split())

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

Solution (Python):

import sys, math, fractions, itertools


def solve(N: int, K: int, A: "List[int]"):
    print(math.ceil(1+(N-K)/(K-1)))
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    K = int(next(tokens))  
    A = [ int(next(tokens)) for _ in range(N) ]  
    solve(N, K, A)

if __name__ == '__main__':
    main()

Solution (Python):

n,k = map(int,input().split())
lst = [int(i) for i in input().split()]

for i in range(n):
    if lst[i] == 1:
        start = i

l = start 
r = n - start -1 

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

else:
    if l == 0: 
        numl = 0
    elif l <= k-1:
        numl = 1
    elif l % (k-1) == 0:
        numl = l // (k-1)
    else:
        numl = (l // (k-1)) + 1
    
    if r == 0: 
        numr = 0
    elif r <= k-1:
        numr = 1
    elif r % (k-1) == 0:
        numr = r // (k-1)
    else:
        numr = (r // (k-1)) + 1
    pat1 = numr + numl
    
    if (n-k)%(k-1)==0:
        pat2 = 1 + (n-k)//(k-1)
    else:
        pat2 = 2 + (n-k)//(k-1)
    print(min(pat1,pat2))

Solution (Python):
import math
N, K = map(int, input().split())
l = list(map(int, input().split()))
print(math.ceil((N-1)/(K-1)))

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

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

print(ans)

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

res = 0
if (N-1)%(K-1) == 0:
    res = (N-1)//(K-1)
else:
    res = (N-1)//(K-1)+1
print(res)

Solution (Python):
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)

Solution (Python):
from math import*
n,k=map(int,input().split())
print(ceil(~-n/~-k))

Solution (Python):
from math import*
n,k=map(int,input().split())
print(ceil((n-1)/(k-1)))

Solution (Python):
N, K = map(int, input().split())

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

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

print(ans)

Solution (Python):
import math
N,K = map(int,input().split())
print(math.ceil((N-1)/(K-1)))

Solution (Python):
N,K = map(int,input().split())

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

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

Solution (Python):
import math

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

a = a[k:]
c = 1

c += math.ceil(len(a) / (k-1))
print(c)

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

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def A():
    s = S()
    a = s.count("-")
    b = s.count("+")
    print(b-a)
    return


def B():
    n = S()
    num = sum(map(int, n))
    n = int("".join(n))
    print(["Yes", "No"][n % num > 0])
    return


def C():
    n, k = LI()
    LI()
    print((n - k) // (k - 1) + 1 + bool((n - k) % (k - 1)))
    return


def D():
    return



if __name__ == '__main__':
    C()

Solution (Python):
n,k=map(int, input().split())
a=list(map(int, input().split()))
 
print(-(-(n-1)//(k-1)))

Solution (Python):
import math
import fractions
import copy
import numpy as np
def j(q):
    if q==1: print("Yes")
    elif q == 0:print("No")
    exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def printrow(a):
    for i in a:
        print(i)
"""

def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
"""
n,k = ips()
a = iprow()
km = k-1
mp = a.index(1)
left = mp
right = n-mp-1
ans  = rem
for i in range(km):
    ap = 0
    lt = max(0,left-i)
    rt = max(0,right-(km-i))
    if lt % km == 0:
        ap += lt // km
    else:
        ap += lt // km + 1
    if rt % km == 0:
        ap += rt // km
    else:
        ap += rt // km + 1
    ans = min(ans,ap)
print(ans+1)

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

Solution (Python):
import math
N, K = map(int, input().split())

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

print(math.ceil((N-1)/(K-1)))

Solution (Python):
import os, sys, re, math

lines = sys.stdin.readlines()

(n, k) = (int(d) for d in lines[0].split())
a = lines[1].split()

result = 0
while n > 0:
    n -= k
    if n > 0:
        n += 1
    result += 1
print (result)

Solution (Python):
import math

b, c  = [int(a) for a in input().split()]
print (math.ceil((b - 1) / ((c - 1) * 1.0)))

Solution (Python):
n, k = map(int, input().split())
print((n + k - 3) // (k - 1))

Solution (Python):
import math
n,k=map(int,input().split())
a=list(map(int,input().split()))
print(math.ceil((n-k)/(k-1)+1))

Solution (Python):
N, K = map(int, input().split())
A = [map(int, input().split())]
print(-(-(N-1)//(K-1)))

Solution (Python):
n, k = (int(i) for i in input().split())
if n <= k:
  print(1)

else:
  ans = 1
  t = k
  while True:
    t = t + k - 1
    ans += 1
    if t >= n:
      break
    
  print(ans)

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

Solution (Python):
from functools import reduce
import math

def main():
    
    
    
    

    
    
    
    
    
    

    
    

    
    
    
    
    
    
    
    
    
    INF = float("inf")

    
    MOD = 10**9+7
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

    
    
    
    
    N, K = (int(_) for _ in input().split())
    A = list(int(_) for _ in input().split())
    
    print(math.ceil((N-1)/(K-1)))
    
if __name__ == '__main__':
    main()

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

p1 = A.index(1) + 1

l = (p1-1) // (K-1)
r = (N-p1) // (K-1)
amari = N - l*(K-1) - r*(K-1)

if N == K:
    ans = 1
elif N <= 2*K-1:
    ans = 2
elif amari == 1:
    ans = l + r
elif amari <= K:
    ans = l + r + 1
else:
    ans = l + r + 2
print(ans)

Solution (Python):
import math
N, K = list(map(int, input().strip().split(' ')))
A = list(map(int, input().strip().split(' ')))
print(math.ceil((N-1) / (K-1)))

Solution (Python):


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

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

ans = []

for i in range(K):
    start = one - (K - 1) + i
    end = one + i

    before = start
    after = N - (end+1)

    before_num = before//(K-1)
    if(before%(K-1) != 0):
        before_num += 1

    after_num = after//(K-1)
    if(after%(K-1) != 0):
        after_num += 1

    answer = before_num + after_num + 1
    ans.append(answer)

print(min(ans))

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

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

print(ans)

Solution (Python):
import math

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

ans=math.ceil((N-1)/(K-1))
print(ans)

Solution (Python):
from math import ceil
N,K = map(int, input().split())
print(ceil((N-1) / (K-1)))

Solution (Python):

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

Solution (Python):
N,K = map(int,input().split())
input()
print(-1*((-1*(N-1))//(K-1)))

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

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

print(cnt)

Solution (Python):
N, K = map(int, input().split())
A = [int(s) for s in input().split()]
print((N - 2) // (K - 1) + 1)

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

position = A.index(1)
counter = 0


counter += position // (K - 1)

counter += (N - position - 1) // (K - 1)

amari = position % (K - 1) + (N - position - 1) % (K - 1)
if amari > 0: amari += 1


counter += amari // K
if amari % K > 0: counter += 1

print(counter)

Solution (Python):
N,K = map(int, input().split())
A = [int(a) for a in input().split()]
integer = N
ans = 0
while integer > 0:
    if integer == N:
        integer = integer - K
        ans += 1
    else:
        integer = integer + 1 - K
        ans += 1
print(ans)

Solution (Python):
import math

N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
print(math.ceil((N-1)/(K-1)))

Solution (Python):
from math import ceil
n, k = map(int, raw_input().split())

print max(1, int(ceil(float(n-1)/(k-1))))

Solution (Python):
n,k=map(int,input().split())
l=list(map(int,input().split()))
for i in range(n):
  if l[i]==1:c=i
l=i;r=n-i-1;ans=0
if l%(k-1)==0:ans-=1
if r%(k-1)==0:ans-=1
print(ans+l//(k-1)+r//(k-1)+2)

Solution (Python):
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
count = 0
while n > 0:
    if count == 0:
        n -= k
        count += 1
    else:
        n -= (k - 1)
        count += 1

print(count)

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

Solution (Python):
from math import ceil

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

Solution (Python):
from math import ceil

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

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

Solution (Python):
n, k = [ int(v) for v in input().split() ]
a = (n-1)//(k-1)
b = (n-1)%(k-1)

if b != 0:
    a += 1
print(a)

Solution (Python):
n, k = map(int, input().split())
a = list(map(int, input().split()))
s = k
ans = 1
while(s < n):
    s += k -1
    ans += 1
print(ans)

Solution (Python):
from sys import stdin
import math
N,K = [int(x) for x in stdin.readline().rstrip().split()]
print(math.ceil((N-1) / (K-1)))

Solution (Python):
import math

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

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

Solution (Python):
n, k = list(map(int, input().split()))
print( (n-1 + k-1 - 1)// (k-1) )

Solution (Python):
n,k=map(int,input().split())
print((n+k-3)//(k-1))

Solution (Python):
N, K = map(int, input().split())
Alist = list(map(int, input().split()))

cnt = 0
for i in range(N):
    if Alist[i]==1:
        cnt = i+1
        break

if K==2:
    print(N-1)
else:
    n = (N-1) // (K-1) + int((N-1)%(K-1)!=0)
    print(n)

Solution (Python):
import math
n,k = map(int,input().split())
print(math.ceil((n-1)/(k-1)))

Solution (Python):
import math
n,k = map(int, input().split())
A = list(map(int, input().split()))
print(math.ceil((n-1)/(k-1)))

Solution (Python):



import math

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

print(math.ceil((N-1)/(K-1)))

Solution (Python):
n,k = map(int,input().split())

print(-(-(n-1) // (k-1)))

Solution (Python):
n,k =map(int,input().split())
a = [int(x) for x in input().split()]
import math
print(math.ceil((n-1)/(k-1)))

Solution (Python):
import math


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

Solution (Python):
from math import ceil
n, k = map(int, input().split())
a = list(map(int, input().split()))
print(ceil((n-1)/(k-1)))

Solution (Python):
n,k = map(int,input().split())
A = list(map(int, input().split()))

ans = (n-1)//(k-1) if (n-1)%(k-1) == 0 else (n-1)//(k-1) + 1
print(ans)

Solution (Python):
n,k = map(int,input().split())
an = list(map(int,input().split()))
import math

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

Solution (Python):
n, k = map(int, input().split())
x = list(map(int, input().split()))

for i in range(1,n+1):
	l=k*i-(i-1)
	if l>=n:
		print(i)
		break

Solution (Python):
import math
import sys
N, K = map(int, input().split())
a_lis = list(map(int, input().split()))

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

if a_lis.index(1) + 1 <= K or N - a_lis.index(1) <= K:
    if K == 2:
        print(N - 1)
        sys.exit()
    print(math.ceil((N - K) / (K - 1)) + 1)
    sys.exit()
else:
    if K == 2:
        print(N - 1)
        sys.exit()
    print(math.ceil((N - K) / (K - 1)) + 1)

Solution (Python):
N,K = map(int,input().split())
L = list(map(int,input().split()))

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

Solution (Python):
N, K = map(int, input().split())
A = map(int, input().split())
print((N-1)//(K-1) if (N-1)%(K-1)==0 else (N-1)//(K-1)+1)

Solution (Python):
import math


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

    pos = A.index(1)
    l = math.ceil(pos / (K - 1))
    r = math.ceil((N - 1 - l * (K - 1)) / (K - 1))
    print(int(l + r))


if __name__ == "__main__":
    main()

Solution (Python):
import math
n,k=map(int,input().split())
al=map(int,input().split())
print(math.ceil((n-1)/(k-1)))

Solution (Python):
n, k = map(int, input().split())
a = list(map(int, input().split()))
min_num = 10**9 + 10
count = 0

for i in range(0, n, k-1):
    check = a[i:i+k]
    num = min(a[i:i+k])
    if len(check) > 1:
        count += 1
    if num < min_num:
        min_num = num

print(count)

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

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

if ((N-1) % (K-1)):
    ans += 1

print(ans)

Solution (Python):
import math

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

ans = math.ceil((N-1)/(K-1))  
print(ans)

Solution (Python):
n, k = map(int, input().split())
s = input()
print(-(-(n - 1) // (k - 1)))

Solution (Python):
import math

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

print(math.ceil((N-1)/(K-1)))

Solution (Python):
N, K = map(int, input().split())
A = list(map(int, input().split()))
if K >= N:
    print(1)
else:
    res = (N - K) // (K - 1) + 1
    if (N - K) % (K - 1) != 0:
        res += 1
    print(res)

Solution (Python):
N,K=map(int,input().split())
print((N-2)//(K-1)+1)

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

Solution (Python):
import math
n, k = map(int, input().split())
a_list = []
a_index = 0
for i, a in enumerate(input().split()):
    if a == 1:
        a_index = i
    a_list.append(a)

left = a_index
right = n - a_index - 1


print(math.ceil((left + right)/(k-1)))

Solution (Python):

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

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

"""

for i in range(len(A)):
    if A[i] == 1:
        point = i

left = point
right = N - point - 1

ans = 0

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

if right % (K-1) == 0:
    ans += right // (K - 1)
else:
    ans += right // (K - 1) + 1
"""

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

print (ans)

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

print((N - 1) // (K - 1) + (0 != (N - 1) % (K - 1)))

Solution (Python):
n,k=map(int,input().split())
a=list(map(int,input().split()))
i=0
while(1):
    if n <= k + (k-1)*i:
        print(i+1)
        break
    else:
        i+=1

Solution (Python):
N, K = map(int, input().split())
_ = list(map(int, input().split()))

now = K
i = 1
while now < N:
    now += K-1
    i += 1

print(i)

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

ans = 0
now = K
i = 1
while now < N:
    now += K-1
    i += 1

print(i)

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  n,k=LI()
  l=LI()

  c=1
  n-=k

  while True:
    if n<=0:
      break

    n-=(k-1)
    c+=1

  return c

print(main())

Solution (Python):
n,k = map(int,input().split())

if n == k:
  print(1)
else:
  c = 1
  a = n-k
  while a > 0:
    c += 1
    a -= k-1
  print(c)

Solution (Python):
from math import ceil

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

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

if N==K:
    print(1)
elif (N-K)%(K-1)==0:
    print(1+int((N-K)/(K-1)))
else:
    print(2+int((N-K)/(K-1)))

Solution (Python):
from math import ceil
N,K = [int(i)-1 for i in input().split()]
A = list(map(int,input().split()))
print(ceil(N/K))

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

a = len(A) - 1
b = K - 1

if a % b == 0:
    ans = a // b
else:
    ans = a // b + 1

print(ans)

Solution (Python):
nk = input().split()
n = int(nk[0])
k = int(nk[1])
if (n-1)%(k-1) == 0:
  a = (n-1)//(k-1)
else:
  a = ((n-1)//(k-1)) + 1
print(a)

Solution (Python):
import math
n, k = map(int, input().split())
a = list(map(int, input().split()))
x = a.index(1)

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

Solution (Python):
N, K = map(int, input().split())
print(-(-(N - 1) // (K - 1)))

Solution (Python):
import math
N, K = map(int, input().split())
A = list(map(int, input().split()))
print(math.ceil((N - 1) / (K - 1)))

Solution (Python):
n, k = [int(v) for v in input().split()]
a_s = [int(v) for v in input().split()]

c1 = 1
n1 = k
c2 = (n - n1) // (k - 1)
n2 = c2 * (k-1)
n3 = n - n1 - n2
c3 = 1 if (n3 > 0) else 0
ans = c1 + c2 + c3
print(ans)

Solution (Python):
N, K = [int(nk) for nk in input().split()]
A = [int(a) for a in input().split()]
if (N-1) % (K-1) == 0:
  print((N-1) // (K-1))
else:
  print(((N-1) // (K-1)) + 1)

Solution (Python):
N, K = [int(nk) for nk in input().split()]
A = [int(a) for a in input().split()]
N -= K
cnt = 1
while N > 0:
  N -= K-1
  cnt += 1
print(cnt)

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  a,b=LI()
  l=LI()

  c=1
  _b=b
  while True:
    if a<=_b:
      break
    else:
      _b+=b-1
      c+=1

  return c

print(main())

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

n = K
cnt = 1
while n < N:
    n += K-1
    cnt += 1
print(cnt)

Solution (Python):
import math
N,K = map(int , input().split())
A = list(map(int , input().split()))

ans = math.ceil((N-1)/(K-1))
print(ans)

Solution (Python):

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

Solution (Python):

import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import numpy as np
import statistics
from statistics import mean, median,variance,stdev
import math

def main():
	N, K = map(int, input().split(" "))
	A = list(map(int, input().split(" ")))
	
	if K >= N:
		print(1)
		sys.exit()
		
	K -= 1
	tmp = 0
	if K != 1:
		if N % K == 0:
			tmp = N // K
		else:
			tmp = N // K
			tmptmp = N - (tmp * K)
			if tmptmp != 1:
				tmp += 1
	else:
		tmp = (N // K) -1
	
	print(tmp)
	
if __name__ == "__main__":
	main()

Solution (Python):

from math import ceil

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

Solution (Python):

from math import ceil

N, K = list(map(int, input().rstrip().split()))
_ = list(map(int, input().rstrip().split()))
print(1 + ceil((N - K) / (K - 1)))