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):
import sys

def resolve():
    N, K = list(map(int, input().split(" ")))
    A = list(map(int, input().split(" ")))
    res = 0
    covered = 0
    while True:
        if covered >= N:
            break
        if res == 0:
            covered = K
        else:
            covered += K - 1
        res += 1
    print(res)

if '__main__' == __name__:
    resolve()

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

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

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

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

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

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

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

Solution (Python):



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


def main():
    s = N - K
    k = K - 1
    ans = 1
    ans += s // k
    if s % k != 0:
        ans += 1
    print(ans)


if __name__ == "__main__":
    main()

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

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

cnt = K
ans = 1
while cnt < N:
    cnt += K - 1
    ans += 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()))

Amin = A.index(1)

left = len(A[:Amin])
right = len(A[Amin:])

ans = 0
if left <= right:
    ans += left // (k-1)
    right += left % (k-1)
    ans += ((right-1) + (k-2)) // (k-1)
else:
    ans += (right-1) // (k-1)
    left += right % (k-1)
    ans += (left + (k-2)) // (k-1)
print(ans)

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

if (A.index(1)+1)>=K and (N-A.index(1))>=K:
  ans=-(-A.index(1))//(K-1)-(-N+A.index(1)+1)//(K-1)
else:
  ans=1-(-N+K)//(K+1)
print(ans)

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

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

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

Solution (Python):
n, k = map(int, input().split())
list_A = list(map(int, input().split()))
a = list_A.index(1) + 1
ans = 0
cnt = 0
amari = 0
if a == 1:
    ans += 0
else:
    ans += (a-1)//(k-1)
    if (a-1)%(k-1) != 0:
        ans += 1
        cnt += 1
        amari += (a-1)%(k-1)

if a == n:
    ans += 0
else:
    ans += (n-a)//(k-1)
    if (n-a)%(k-1) != 0:
        ans += 1
        cnt += 1
        amari += (n-a)%(k-1)

if cnt == 2 and amari <= k-1:
    ans -= 1

print(ans)

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

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

Solution (Python):


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,k = LI()
a = LI()
print((n-2)//(k-1)+1)

Solution (Python):

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)))

Solution (Python):
n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
    if a[i] == 1:
        m = i
        break
l = [m - k + 1, m]
ans = 114514
for i in range(k):
    x = l[0] + i
    y = l[1] + i
    if not x < 0 and not y >= n:
        c = 1
        while True:
            if x <= 0:
                break
            x -= k - 1
            c += 1
        while True:
            if y >= n - 1:
                break
            y += k - 1
            c += 1
        if c < ans:
            ans = c
print(ans)

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

if n<=0:
  pass
else:
  while n>0:
    n-=k
    count+=1
    
print(count)

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=list(map(int, input().split()))

num=0
while num*K-(num-1)<N:
    num+=1
print(num)

Solution (Python):
import math

def Minimization(n , k , al):

    ans = math.ceil((n - 1) / (k - 1))

    return ans

def main():
    n , k = map(int , input().split())
    al = list(map(int , input().split()))
    print(Minimization(n , k , al))

if __name__ == '__main__':
    main()

Solution (Python):
import sys

import bisect






import itertools


import math



readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n, k = list(map(int, readline().split()))
    a = list(map(int, readline().split()))

    ans = 1
    rem = max(n - k, 0)
    ans += math.ceil(rem / (k - 1))

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
import math

n, k = map(int, input().split())
lst = 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()))


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

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

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

Solution (Python):
n, k = (int(x) for x in input().split())

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

if n == k:
    print(1)
elif k == 2:
    print(n-1)
else:
    rem = n % (k-1)
    m = (n - rem) / (k-1)
    if rem <= 1:
        print(int(m))
    else:
        print(int(m+1))

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

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

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(1 + (N-1)//(K-1))

Solution (Python):
def main():
    n, k = map(int, input().split())
    *a, = map(int, input().split())
    ans = 1
    n -= k
    while n > 0:
        ans += 1
        n -= k - 1
    return ans

print(main())

Solution (Python):








import sys
sys.setrecursionlimit(10 ** 5 + 10)


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

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


resolve()

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

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

if (N-1) % (M-1) != 0:
  ans += 1
  
print(ans)

Solution (Python):


def solve():
    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)



if __name__ == "__main__":
    solve()

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


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

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 = input()

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

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

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

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

Solution (Python):
n,k,*a=map(int,open(0).read().split())
print((n+k-3)//(k-1))

Solution (Python):
n,m=map(int,input().split()) 
l=list(map(int,input().split())) 
print(-(-(len(l)-m)//(m-1))+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):
n,k=map(int,input().split())
print(-(-(n-1)//(k-1)))

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

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

Solution (Python):
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(-(-i//k)-(-(n-i-1)//k))

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

Solution (Python):
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd



import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def find_gcd(list_l):
    x = reduce(gcd, list_l)
    return x


def main():
    n,k = map(int,input().strip().split())
    a = list(map(int, input().strip().split()))
    x_min=min(a)
    m=n
    for i in range(n):
        if a[i]==x_min:
            m-=1
    print(-(-m//(k-1)))


if __name__ == '__main__':
    main()

Solution (Python):




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

    print((N + K - 3) // ~-K)


if __name__ == "__main__":
    main()

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

ans = 1 if n//k > 0 else 0 
mod = (n-k)//(k-1) + min((n-k)%(k-1), 1)
print(ans + mod)

Solution (Python):
N, K = map(int, input().split())
L = 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 math import ceil

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

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

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

idx = A.index(1)

ans = N
for k in range(K + 1):
    L = idx - (K - k - 1)
    R = (N - 1 - idx) - k
    cntL = 0
    cntR = 0
    while L > 0:
        cntL += 1
        L -= K - 1
    while R > 0:
        cntR += 1
        R -= K - 1
    ans = min(ans, cntL + cntR + 1)

print(ans)

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

Solution (Python):
import math

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


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

Solution (Python):
import math,sys

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










  



l = K
count = 1
if l >= N:
  print(count)
  sys.exit()
  
while l < N:
  l += K - 1
  count += 1

print(count)

Solution (Python):
listlen, rensuu = map(int, input().split())
listnum = list(map(int, input().split()))
count = 0
count += (listlen - 1) // (rensuu - 1)
count += 1 if (listlen - 1) % (rensuu - 1) > 0 else 0
print(count)

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

if N == K:
    print(1)
else:
    cnt = 1
    N -= K
    while N > 0:
        cnt += 1
        N -= K
        N += 1
    print(cnt)

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

Solution (Python):
n,k=map(int,input().split())
a=list(map(int,input().split()))
aa=min(a)
n-=k
import math
q=0
if n%(k-1)==0:
    q+=n//(k-1)
else:
    q+=n//(k-1)+1
print(q+1)

Solution (Python):
import math
N,K = map(int,input().split())
L = [i for i in map(int,input().split())]

  

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

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

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

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

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())
ans = 1 + ((N - K) + (K - 2)) // (K - 1)
print(ans)

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

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):
import math

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


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

print(ans)

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

Solution (Python):
import math

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

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

print(ans)

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

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

id_of_one = lst.index(1) 

left = len(lst[0:id_of_one]) 
right = len(lst[id_of_one+1:]) 
total = left + right





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

print(counter)

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

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

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

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

Solution (Python):

import math
N,K = map(int, input().split())
A = list(map(int, input().split()))
tmp = 0





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

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):
import math

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


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

Solution (Python):


import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

from math import ceil

N, K = na()
A = na()

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

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

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):
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()))
count = 0
i = 1

for _ in range(N):
  i = i + K - 1
  if i < N:
    count += 1

  else:
    count += 1
    break

print(count)

Solution (Python):

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

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




n,k=map(int,input().split())
ans=1
now=k
while now<n:
    
    ans+=1
    now+=k-1
print(ans)

Solution (Python):
import math
n, k, *nums = map(int, open(0).read().split())
print(math.ceil((n-k)/(k-1))+1)

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

Solution (Python):
n, k, *a = map(int, open(0).read().split())
print((n+k-3)//(k-1))

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

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

Solution (Python):

def read_input():
    n, k = map(int, input().split())
    alist = map(int, input().split())

    return n, k, alist


def submit():
    n, k, alist = read_input()

    if k >= n:
        print(1)
        return

    n = n - k
    if n % (k - 1):
        print(n // (k - 1) + 2)
    else:
        print(n // (k - 1) + 1)


if __name__ == "__main__":
    submit()

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

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

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

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)))


if __name__ == '__main__':
    main()

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


ans = 0
while n > 0:
    if n == k:
        ans += 1
        break
    n -= k - 1
    ans += 1

print(ans)

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

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

Solution (Python):

import numpy as np
from functools import reduce
from operator import add,sub,mul,truediv
from fractions import gcd

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):
n,k=map(int,input().split())
print((n-3+k)//(k-1))

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

if __name__ == '__main__':
    main()

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

Solution (Python):
import bisect

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

amin=min(a)
m=bisect.bisect(a,amin)

for i in range(n):
    if a[i]==1:
        m=i+1
        

k1=k-1


if k1==1:
    print(n-1)
else:
    if m==0:
        n2=(n-1)//k1+1
        print(n2)
    elif m==n:
        n2=(n-1)//k1+1
        print(n2)
    else:
        n2=(m-1-1)//k1+1
        n2r=(n2)*k1-(m-1)
        n3=(n-m-1-n2r)//k1+1

        print(n2+n3)

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

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):
n,k = map(int,input().split())
a = list(map(int,input().split()))
s = k
i = 1
while n > s:
    s += (k-1)
    i += 1

print(i)

Solution (Python):
import math
n,k = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]

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

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

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

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


indx = a.index(min(a))
i = (indx-1) + (n-indx)

if i % (k-1) == 0:
    print(int(i/(k-1)))
else:
    print(int(i/(k-1))+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 = [int(i) for i in input().split()]
print(math.ceil((N-1)/(K-1)))

Solution (Python):
import math

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

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 = 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)

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

if k < n:
    c = 1
    n -= k
    c += -((-n)//(k-1))
    print(c)
else:
    print(1)

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

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

Solution (Python):
import math

def main():
    n, k = [int(e) for e in input().split()]
    A = [int(e) for e in input().split()]

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

if __name__ == "__main__":
    main()

Solution (Python):
N,K = map(int,input().split())
A = list(map(int,input().split()))
count = 0
while N > 1:
  N -= K - 1
  count += 1
print(count)

Solution (Python):
N,K=map(int,input().split())
A=list(map(int,input().split()))
ans = 1
N -= K
while N>0:
  ans += 1
  N -= K-1
print(ans)

Solution (Python):
import math

N, K_ko = map(int, input().split())
A = input()
ans = math.ceil((N - K_ko) / (K_ko - 1)) + 1
print(ans)

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

Solution (Python):
import math
N, K = map(int, input().split())
A_list = [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()))
print((n-1)//(k-1)+int(bool((n-1)%(k-1))))

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()))
x = n-k
if x == 0:
    print(1)
else:
    print(1 + (x+k-2)//(k-1))

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

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

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

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

Solution (Python):
import math
a,b = map(int,input().split())
l = sorted(list(map(int,input().split())))

ans = math.ceil((a-1) / (b-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())
A = list(map(int, input().split()))
answer = 100000
while True:
    if n <= k + (k - 1) * (answer - 1):
        answer -= 1
    else:
        break

print(answer + 1)

Solution (Python):
n,k=map(int,input().split())
a=sorted(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)

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
import itertools


N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
point = 0
i = 0
while N > point:
    i+=1
    if i==1:
        point+=K
    else:
        point+=(K-1)

print(i)

Solution (Python):

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

Solution (Python):

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

Solution (Python):
import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce
import statistics




def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList





data1 = getInputListInt()
n = data1[0]
k = data1[1]
data2 = getInputListInt()

tmp = n - 1
ans = math.ceil(tmp/(k-1))

print(ans)

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


def ceil(x, y):
    if x % y == 0:
        return x // y
    else:
        return x // y + 1


print(ceil(n-1, k-1))

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

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

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

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

Solution (Python):
n, k = list(map(int, input().split()))
a = input()
ans = []
left = a.index('1')
right = n -left -1
for i in range(k):
    l = left-i
    r = right-k+1+i
    if l==0:
        ans.append(right//k+1)
    else:
        ans.append((l-1)//(k-1)+1+1+(r-1)//(k-1)+1)
print(min(ans))

Solution (Python):
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res

N,K=LI()
LI()
print(1 + (N-K)//(K-1) + (1 if (N-K) % (K-1) else 0))

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

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