peterverebics/CodeNet_Python_118 huggingface dataset:
s = input()

if s[0] != "A" or (s[2] != "C" and s[-1] != "C"):
  print("WA")
elif s[0] == "A" and s[2] == "C":
  s = list(s)
  s.pop(0)
  s.pop(1)
  for i in range(len(s)):
    if s[i] != s[i].lower():
      print("WA")
      exit()
elif s[0] == "A" and s[-1] == "C":
  s = list(s)
  s.pop(0)
  s.pop(-1)
  for i in range(len(s)):
    if s[i] != s[i].lower():
      print("WA")
      exit()
      
print("AC")
s = input()
if s[0] == 'A' and s[2:-1].count('C') == 1:
     list(s).remove("A")
     list(s).remove("C")
     if s.islower() == 0:
          print("AC")
          exit()
else:
     print("WA")
def isA(S):
    return S[0] == 'A'


def isC(S):
    count = 0
    for s in S[2:-2]:
        if s == 'C':
            count += 1

    return count == 1


def isAllLower(S):
    all_lower = True
    for s in S[1:]:
        if s == 'C':
            continue

        if s.isupper():
            all_lower = False

    return all_lower


S = input()

if isA(S) and isC(S) and isAllLower(S):
    print('AC')
else:
    print('WA')
def main():
    S = input()
    l = len(S)
    if S[0] == "A" and S[2:l - 1].count("C") == 1 and (S[1] + S[3:l - 2] + S[l - 1]).islower():
        print("AC")
    else:
        print("WA")


if __name__ == "__main__":
    main()
S = str(input())
alp = "ABDEFGHIJKLMNOPQRSTUVWXYZ"
if S[0] == 'A' and S.count('C') == 1 and S[2:-1].count('C') == 1:
  for i in range(1,len(S)-1):
    if S[i] in alp:
      print("WA")
      exit()
  print("AC")
else:
  print("WA")
#abc104 b
s=input()
x=s[2:-1]
flag=True
if s[0]!="A":
    flag=False
cnt=0
for i in range(len(x)):
        if x[i]=="C":
            cnt+=1
        else:
            if x[i].islower()==False:
                flag=False
if cnt!=1:
    flag=False
if flag:
    print("AC")
else:
    print("WA")
s = list(input())
if (s[0]=="A") and (s[2:-1].count("C")==1):
  s.remove("A")
  s.remove('C')
  if str(s).islower():
    print("AC")
else:
  print('WA')
s = list(input())

#chr(ord('a')

ans = True
if s[0] != "A":
    print("WA")
elif s[2:-2].count("C") != 1:
    print("WA")
else:
    s.remove("A")
    s.remove("C")
    if not str(s).islower():
        print("WA")
    else:
        print("AC")
import sys


def main():
    s = list(input())
    if s[0] != 'A' and s[2:-1].count("C") != 1:
        print("WA")
    else:
        for i in range(1, len(s)):
            if ord(s[i]) < ord('a') and i != s.index('C'):
                print("WA")
                sys.exit(0)
        print("AC")


if __name__ == "__main__":
    main()
word=input()
cflg=True
if word[0]!='A':
  cflg=False
  print(cflg)
elif word[2:-2].count('C')!=1:
  cflg=False
cnt=0
for l in word[1:]:
  if l.isupper():
    cnt+=1
else:
  if cnt!=1:
    cflg=False
  
if cflg:
  print('AC')
else:
  print('WC')
def check(s):
    if s[0].isupper() and s.count('C') == 1  and  3<= s.index('C') < len(s) -1:
        temp = s[1: s.index('C')] + s[s.index('C')+1: ]
        if temp.islower():
            return 'AC'
    return 'WA'


s= input()
print( check(s))
import sys
input = sys.stdin.readline

S = list(input().rstrip('\n'))
# print(S[:3])
# print(S[-2:])
if S[0] == 'A' and S[2:-1].count('C') == 1:
    S.remove('A')
    S.remove('C')
    S = ''.join(S)
    # print(S)
    if S.islower:
        print("AC")
    else:
        print("WA")
else:
    print("WA")
S = input()

if S[0] != 'A':
    print('WA')
    exit()

if S[2:-2].count('C') != 1:
    print('WA')
    exit()

for i in range(2,len(S)):
    if i != S.index('C') or i == len(S):
        if not S[i].islower():
            print('WA')
            exit()

print('AC')
S = input()
T = S[2:-1]
c = 0
d = 0
U = ''
for i,t in enumerate(T):
  if t =='C':
    c+=1
  else:
    U += t
if S[0]=='A' and c==1 and U.islower():
  print('AC')
else:
  print('WA')
import numpy as np

S = input()
cond1 = (S[0] == 'A')

cnt = S.count('C', 2, len(S)-1)
cond2 = (cnt == 1)

if(cond1 and cond2):
    print("AC")
else:
    print("WA")
s = input()
ac = True
c = True
if s[0] != "A":
  ac = False
if not ord("a") <= ord(s[1]) <= ord("z"):
  ac = False
if not ord("a") <= ord(s[-1]) <= ord("z"):
  ac = False
for i in range(2, len(s)-1):
  if s[i] == "C":
    if c:
      c = False
    else:
      ac = False
  else:
    if not ord("a") <= ord(s[i]) <= ord("z"):
      ac = False
if ac:
  print("AC")
else:
  print("WA")
import sys
S=input()
first=S[0]
cnt=0
moji=[i for i in "abcdefghijklmnopqrstuvwxyz"]

if first=="A":
  for i in range(2,len(S)-1):
    if S[i]=="C":
      cnt+=1
    else:
      for j in moji:
        if S[i] in moji == False:
          print("WA")
          sys.exit()
          
  if cnt==1:
    print("AC")
  else:
    print("WA")
        
else:
  print("WA")
s = input()
if s[0]=="A" and s[2:-1].count("C")==1:
    print("AC")
else:
    print("WA")
S=input()
if S[0]=="A" and S[2:-1].count("C")==1 and S[1].islower():
    for s in S[2:]:
        if s!="C":
            if s.islower():
                print("AC")
                exit()
print("WA")
import sys
S = input()

if S[0] is 'A' and S[2:-2].count('C') == 1:
    S = S[1:]
    num = S.index('C')
    for i, j in enumerate(S):
        if i == num or j.islower():
            continue
        else:
            print('WA')
            sys.exit()
    print('AC')
else:
    print('WA')
s = input()
length = len(s)
cnt = 0

if s[0] != 'A':
    print('WA')
    exit()

for i in range(2, length-1):
    if s[i].isupper():
        if s[i] != 'C':
            print('WA')
            exit()
        else:
            cnt += 1

if cnt != 1:
    print('WA')
    exit()

print('AC')
exit()
s = str(input())
n = len(s)
if s[0] == "A":
    if "C" in s[2: n - 1]:
        cntA = 0
        cntC = 0
        for i in s:
            if i == "A":
                cntA += 1
            if i == "C":
                cntC += 1
        if cntA == 1 or cntC == 1:
            print("AC")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")
S = input()
if not S[0] == 'A':
    print('WA')
    exit()
if not S[2:-1].count('C') == 1:
    print('WA')
    exit()
if not (S[1] + S[2:-1].replace('C', '')).islower():
    print('WA')
    exit()
print('AC')
def main():

    test = input()
    if test[0] != "A":
        print("WA")
        return

    if test[:-1][2:].count("C") != 1:
        print("WA")
        return

    for i in range(2, len(test) - 1):
        if test[i] == "C": continue

        if test[i].lower() != test[i]:
            print("WA")
            return

    print("AC")

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

	s = input()
	ans = 0
	flg = False
	
	if s[0] == "A":
		tmp = s[2:-1]
		if s.count("C") == 1 and tmp.count("C") == 1:
			tmp2 = s[1:-1]
			tmp2 = tmp2.replace("C","c")
			if tmp2.lower() == tmp2:
				flg = True

	if flg == True:print("AC")
	else:		print("WA")
S = input()
if S[0] != "A":
  print("WA")
  exit()
elif S[2:-2].count("C") == 1 and S.count("C") == 1:
  print("WA")
  exit()
else:
  S = S[1:].replace("C", "")
  if S.islower():
    print("AC")
  else:
    print("WA")
S = input()
if S[0] != "A":
    print("WA")
    exit()
if S[2:-2].count("C") != 1:
    print("WA")
    exit()
if (S[1:S.index("C",2)] + S[S.index("C",2)+1:]).islower():
    print("AC")
else:
    print("WA")
S = input()
N = len(S)
 
cond1 = True if S[0] == 'A' else False
cond2 = True if S[2:-2].count('C') == 1 else False
cond3 = True if sum(map(lambda x: x.islower(), S)) == N-2 else False
 
print('AC') if cond1 and cond2 and cond3 else print('WA')
s=str(input())
s[0] == "A"
print(s[2:-1])
if s[2:-1].count('C') ==1:
    if s[1:].replace('C','').islower():
        print("AC")
    else:
        print('WA')
else: print("WA")
S = list(input())
n = len(S) - 1
C = 0
count = 0
if S[0] == 'A':
    for i in range(2,n-1):
        if S[i] == 'C':
            C += 1
            Cnumber = i
    if C == 1:
        for i in range (n):
            if S[i].isupper():
                count += 1
                
    if count == 2:
        print('AC')
        
else:
    print('WA')
s = input()
flag = 1
if s[0] == "A":
    tmp = s[2:-2].find("C")
    if tmp >= 0:
        tmp2 = s[1]
        tmp2 += s[tmp+3:]
        if tmp2 == tmp2.lower():
            flag = 0
if flag == 0:
    print("AC")
else:
    print("WA")
S = input()

if S[0] != "A":
  print("WA")
  exit()
if S[2] != "C":
  print("WA")
  exit()
if S[1]+S[3:] != (S[1]+S[3:]).lower():
  print("WA")
  exit()

print("AC")
S = input()
ans = 'WA'
if S[0] == 'A' and S[2:-1].count('C'):
    if S[1:].replace('C', '').islower():
        ans = 'AC'
print(ans)
if __name__ == '__main__':

	s = input()
	ans = 0

	if s[0] == "A":	ans += 1

	tmp = s[2:-1]
	if tmp.count("C") == 1:
		ans += 2

	tmp2 = s[1:-1]
	tmp2 = tmp2.replace("C","c")
	if tmp2.lower() == tmp2:ans += 4

	if ans == 7:print("AC")
	else:		print("WA")
S = input()

if S[0] == "A":
    if S[2:-1].count("C") == 1:
        idx = S[2:-1].index("C") + 2
        S = S[1:idx] + S[idx+1:]
        if S == S.lower():
            print("AC")

print("WA")
import sys
s = input()

if s[0] != "A":
  print("WA")
  sys.exit()

if s[2] != "C":
  print("WA")
  sys.exit()
  
c = 0
for i in range(1,len(s)-1):
  if s[i] == "C":
    c += 1

if c != 1 :
  print("WA")
  sys.exit()

for i in range(len(s)):
  if s[i] != "A" and s[i] != "C":
    if ord(s[i]) < 97  or  122 < ord(s[i]):
      print("WA")
      sys.exit()
 
print("AC")
s = input()
if s[0]=='A' and s[2:-1].count('C')==1:
    S = list(s)
    S[0] ='a'
    for i in range(2,len(S)-2):
        if S[i] == 'C':
            S[i] = 'c'
    news = ''.join(S)
    if news.islower():
        print('AC')
    else:
        print('WA')
else:
    print('WA')
s = input()
if s[0] != 'A':
    print('WA')
    exit(0)
if s[2:-1].count('C') != 1:
    print('WA')
    exit(0)
for i in range(1,len(s)):
    if i >= 2 and i < len(s)-1 and s[i] == 'C':
        continue
    if not (ord('a') <= ord(s[i]) and ord(s[i]) <= ord('z')):
        print(i)
        print('WA')
        exit(0)
print('AC')
S = input()
if S[0] == 'A' and S[2] == 'C' and S[-2] == 'C':
    S_list = list(S)
    del S_list[0]
    del S_list[1]
    del S_list[-2]
    new_S = ''.join(S_list)
    small_s = new_S.lower()
    if small_s == new_S:
        print('AC')
else:
    print('WA')
#ABC104

s = input()

if s[0] == "A" and s[2:-2].count("C") == 1:
    k = s[2:-2].index("C") + 2
    
    if str.islower(s[1:k] + s[k+1:]):
        print("AC")
    else:
        print("WA")
else:
    print("WA")
s = input()
f = False
c = 0
if s[0] =="A":
    f = True
for x in s[2:len(s)-2]:
    if x == "C":
        c +=1
if f and c==1:
    print("AC")
else:
    print("WA")
s = input()
ans = True
if s[0]!='A':
  ans = False
if s[2:-1].count('C')!=1:
  ans = False
upper = 0
for i in  s:
  if i.isupper:
    upper += 1
if upper != 2:
  ans = False
if ans:
  print('AC')
else:
  print('WA')
S = input()

ans = "AC"

if S[0] != 'A' or S[2:-1].count('C') != 1 or S[-1] == 'C' or S[1] == 'C':
  ans = "WA"
for i in range(1, len(S)):
  if S[i].isupper == True and S[i] != 'C':
    ans = "WA"
print(ans)
def check(s):
    if s[0].isupper() and s.count('C') == 1  and  2<= s.index('C') < len(s) -1:
        i = s.index('C')
        temp = s[1: i] + s[i+1: ]
        if temp.islower():
            return 'AC'
    return 'WA'


s= input()
print( check(s))
s = input()
if s[0] != 'A':
  print('WA')
  exit()
s = s[1:]
ccnt = 0
for i in s[1:-1]:
  if i == 'C':
    ccnt += 1
  elif ord(i) < ord('a') or ord('z') < ord(i):
    print('WA')
    exit()
if ccnt != 1 or (ord(s[-1]) < ord('a') or ord('z') < ord(s[-1])):
  print('WA')
  exit()
else:
  print('AC')
s=input()
ans='AC'
if s[0]!='A':
  ans='WA'
elif s[2:-1].count('C')!=1:
  ans='WA'
if ans=='AC':
  s=s.replace('A','')
  s=s.replace('C','')
  if s.islower!=False:
    ans='WA'
print(ans)
s = str(input())
if s[0] == 'A' and s[2:-1].count('C') == 1 and (s[2:s.find('C')]+s[s.find('C')+1]).islower():
    print('AC')
else:
    print('WA')
S = list(input())

if S[0] != 'A':
    print('WC')
elif S[2:-1].count('C') != 1:
    print('WC')
else:
    S = list(S[1:])
    S.remove('C')
    S = ''.join(S)
    if S.islower():
        print('AC')
    else:
        print('WC')
s=str(input())
if s[0] == "A" and s[2:-1].count("C") == 1:
    if s[1].islower() and s[-1].islower():
        print("AC")
else:
    print("WA")
import sys
S = list(input())
C_cnt,low,upp = 0,0,0
if S[0] != "A" or S[-1].isupper():
  print("WA")
  sys.exit()
for i in range(1,len(S)-1):
  if S[i] == "C":
    C_cnt += 1
  elif S[i].islower():
    low += 1
  elif S[i].isupper():
    upp += 1
if C_cnt == 1 and low == len(S)-3 and upp == 0:
  print("AC")
else :
  print("WA")
S = input()

ans = "AC"

if S[0] != 'A' or S.count("C", 2, len(S)-1) != 1:
  ans = "WA"
for i in range(1, len(S) - 1):
  if S[i].isupper == True and S[i] != 'C':
    ans = "WA"
print(ans)
s = input()
length = len(s)
count = 0
count_large = 0
sep = s[2:length-2]


if s[0] == 'A':
    count += 1

if sep.count('C') == 1:
    count += 1

for i in range(length):
    if s[i].isupper():
        count_large += 1
        
if count_large == 2:
    count += 1

if count == 3:
    print('AC')
else:
    print('WA')
s=str(input())
f=s[0]=="A" and s[2:-1].count("C")==1
g=(s[:2]+s[2:-1].replace("A","a").replace("C","c")+s[-1]).islower()
h=f and g
print("AC" if h is True else "WA")
# ABC101 C - Minimization
# N <= K + (K-1)(g-1)を満たす最小のgが答え
from math import ceil
N, K = map(int, input().split())
A = list(map(int, input().split()))
g = 1
while True:
    if N <= K + (K-1)*(g-1):
        break
    else:
        g += 1
print(g)
import math
n,k=map(int,input().split());print(math.ceil((n-1)/(k-1)))
N, K = list(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()))
import math
ans = math.ceil((n - 1) / (k - 1))
print(ans)
n , k = map(int,input().split())
print((n-2)//(k-1)+1)
import math

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

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

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

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

idx = a.index(1)
num_l = idx
num_r = n - idx - 1

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

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

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

# 1以外の要素n-1個を、k-1で割る(1項ずつ重複させるため)。余りは1回と数えるので、切り上げる
print(-((-n+1) // (k-1)))
n,k=map(int,input().split())
A=list(map(int,input().split()))
print((n-2)//(k-1)+1)
from math import ceil
N, K = map(int, input().split())
A = list(map(int, input().split()))
if N == K:
    print(1)
elif (N-1)%(K-1) == 0:
    print((N-1)//(K-1))
elif K == 2:
    print(N-1)
else:
    ans = ceil(N/(K-1))
    print(ans)
import math
n,k=map(int,input().split());input();print([math.ceil((n-k)/(k-1))+1,1][n==k])
from math import ceil
N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = ceil((N-1)/(K-1))
print(ans)
x, y = map(int,input().split())
li = list(map(int,input().split()))

if (x-1)%(y-1) == 0:
    print((x-1)//(y-1))
else:
    print((x-1)//(y-1)+1)
import math
n,k=map(int,input().split());a=list(map(int,input().split()))
print([math.ceil((n-k)/(k-1))+1,1][n==k])
N, K = map(int, input().split())
A = [int(x) for x in input().split()]
ans = 1
n = (N-K)//(K-1)
ans += n
if N-K-n*(K-1) > 0:
    ans += 1
print(ans)
import math
n,k=map(int,input().split())
a=list(map(int,input().split()))

b=math.ceil((n-1)/(k-1))
print(b)
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)
def main():
    from math import ceil
    n, k, *a = map(int, open(0).read().split())
    ans = 1 + ceil((n - k) / (k - 1))
    print(ans)


if __name__ == '__main__':
    main()
n,k = map(int,input().split())
a = list(map(int,input().split()))
i = 1
while  n > k + (k-1)*(i-1):
    i += 1

print(i)
n,k=map(int,input().split())
l=list(map(int,input().split()))
if n<=k:
    print(1)
    exit()
c=1
while 1:
    if n<=k:
        break
    n-=(k-1)
    c+=1
print(c)
N,K=map(int,input().split())
A=list(map(int,input().split()))
cnt=0
for i in range(10**5+1):
    N-=K
    cnt+=1
    if N<=0:
        break
    else:
        N+=1
print(cnt)
n,k = map(int , raw_input().split())
c = n - k 
p = k - 1
print 1 + (c + p-1)/p
import math

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

p = 0
for i in range(n):
    if aa[i] == 1:
        p = i
        break

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

## Trivial = (N-1)//(K-1)

if (N-1) % (K-1) == 0:
  print( (N-1)//(K-1) )
else:
  print( (N-1)//(K-1) + 1)
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
import bisect
n,k=map(int,input().split())
a=list(map(int,input().split()))
ix=a.index(1)
i=math.ceil((n-k)/(k-1))+1
print(i)
n, k = map(int, input().split())
a = list(map(int, input().split()))
mini = a.index(1)
l = mini // (k-1)
lm = mini % (k-1)
r = (n - mini - 1) // (k-1)
rm = (n - mini - 1) % (k-1)
# print(l, r, lm, rm)
print(l + r + ((lm + rm + 1) // k + ((lm + rm + 1) % k != 0 and (lm + rm) != 0)))
from math import ceil
n,k=map(int,input().split())
a=list(map(int,input().split()))
n-=1
k-=1
print(ceil(n/k))
N, K = map(int, input().split())
A = input()
print((N+K-3)//(K-1))
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())
x = tuple(map(int, input().split()))

for i,v in enumerate(x):
    if v == 1:
        r = i
a,b = divmod(r,k-1)
if b > 0:
    a += 1
r = a * (k-1)

l = n-r-1
if l > 0:
    c,d = divmod(l, k-1)
    if d > 0:
        c += 1
    a += c

print(a)
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)
#!/usr/bin/env python3
import math

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

index = a.index(1)

pre = index
post = n-index-1

ans = 10**10
for i in range(0, k):
    ans_tmp = 0
    pre_tmp = max(0, pre-i)
    post_tmp = max(0, post-(k-1-i))
    ans_tmp += math.ceil(pre_tmp/(k-1))
    ans_tmp += math.ceil(post_tmp/(k-1))
    ans = min(ans, ans_tmp)
    # print(pre_tmp, post_tmp, ans)

print(ans+1)
import math

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

print(math.ceil((n-1)/(k-1)))
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)
import math
N, K = map(int, input().split())
print(math.ceil((N-1)/(K-1)))
import sys
import math

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

for i in range(N):
    if A[i] == 1:
        ans = N
        for j in range(max(0, i-(K-1)), min(N, i+K-1)):
            ans = min(math.ceil(j/(K-1)) + math.ceil((N-j-1)/(K-1)), ans)
        break
print(ans)
import math

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

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


def ceil(a, b):
    return -(-a // b)


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

print((n+k-3)//(k-1))
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)
import sys
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
start = 0
end = k
count = 0
for i in range(n):
    if a[n-1]==1:
        print(count)
        sys.exit()
    a[start:end] = [1]*k
    start += (k-1)
    end += (k-1)
    count += 1
import sys

n, k = map(int, sys.stdin.readline().split())

def main():
    print((n + k - 3) // (k - 1))

if __name__ ==  '__main__':
    main()
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
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

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

    ans = 1
    N -= K
    ans += (N + K - 2)//(K - 1)
    print(ans)
if __name__ == '__main__':
    main()
N, K = map(int, input().split())
A=list(map(int, input().split()))

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

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

print(math.ceil((n-1)/(k-1)))
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))
import sys
input = sys.stdin.readline


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


if __name__ == "__main__":
    main()
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)))
N, K = map(int, input().split())
A = list(map(int, input().split()))

ans = 0
index = 1
while index <= (N - 1):
  ans += 1
  index += (K-1)
print(ans)
N, K = map(int, input().split())
A = [int(i) for i in input().split()]
A.sort()
for i in range(1, N):
    if A[i] != A[0]:
        idx = i
        break
# int((N - idx) / K)
if (N - idx) % (K - 1) == 0:
    print(int((N - idx) / (K - 1)))
else:
    print(int((N - idx) / (K - 1)) + 1)
n, k = map(int, input().split())
a = list(map(int, input().split()))

if (n + k - 1) // k == 1:
    print(1)
else:
    res = ((n - k) + (k - 2)) // (k - 1) + 1
    print(res)
#全部1にしたい
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
#端っこから区間をあらかじめ区切っておく
ans=0
i=0
while i<n-1:
  ans=ans+1
  i=i+k-1
  
  
print(ans)
n,k=map(int,input().split())
a = list(map(int,input().split()))

if (n-1)%(k-1) != 0:
  cnt = (n-1)//(k-1)+1
else:
  cnt = (n-1)//(k-1)
  
print(cnt)
#!/usr/bin/env python3
#ABC101 C

import math

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

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

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

ans = 0

print(math.ceil((N-1)/(K-1)))
import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
mod = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

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

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

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

p = 0
cnt= 0

while p < n - 1:
    p += k - 1
    cnt += 1
print(cnt)
n, k = map(int, input().split())
As = list(map(int, input().split()))

idx = As.index(min(As))
left = idx

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

right = n - ((n_l) * (k-1)) - 1

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

print(n_l + n_r)