Problem:

Pilling Blocks

  We make a tower by stacking up blocks. The tower consists of several stages and each stage is constructed by connecting blocks horizontally. Each block is of the same weight and is tough enough to withstand the weight equivalent to up to $K$ blocks without crushing.

  We have to build the tower abiding by the following conditions:

Every stage of the tower has one or more blocks on it.

Each block is loaded with weight that falls within the withstanding range of the block. The weight loaded on a block in a stage is evaluated by: total weight of all blocks above the stage divided by the number of blocks within the stage.

  Given the number of blocks and the strength, make a program to evaluate the maximum height (i.e., stages) of the tower than can be constructed.

Input

The input is given in the following format.

$N$ $K$

  The input line provides the number of blocks available $N$ ($1 \leq N \leq 10^5$) and the strength of the block $K$ ($1 \leq K \leq 10^5$).

Output

  Output the maximum possible number of stages.

Sample Input 1

4 2

Sample Output 1

3

Sample Input 2

5 2

Sample Output 2

4



Sample input:
4 2


Sample output:
3

Submission status: Wrong Answer

Solution code:
N,K = map(int, input().split())
t = n = a = 1
while True:
    n = (K+a-1)/K
    a += n;
    if  N < a: break
    t += 1
print(t)

Submission status: Accepted

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

ans = 0
d,s = 1,0
while True:
    # s/d <= k
    # s <= d*k
    while d*k < s:
        d += 1
    if s+d > n:
        break
    s += d
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
N,K = map(int, input().split())
t = n = a = 1
while True:
    n = (K+a-1)//K
    a += n;
    if  N < a: break
    t += 1
print(t)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
ans = 1
w = 1
while n-w>0:
    blw = (w+k-1)//k
    w += blw
    if n-w>=0: ans+=1
print(ans)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
ans = 1
s = 1
N -= 1
while 1:
    m = (s+K-1) // K
    if N < m:
        break
    s += m; N -= m
    ans += 1
print(ans)

Submission status: Accepted

Solution code:

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

weight = 1
ans = 1
N -= 1

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

Submission status: Accepted

Solution code:
n,k = map(int, input().split())
res = 0
row = 1
w = 0
while n >= row :
    if row*k >= w :
        res += 1
        w += row
        n -= row
    elif n >= row+1 : row += 1
    else : break
print(res)

Submission status: Accepted

Solution code:
import math
n, k = map(int, input().split())
ret = 1
acc = 1
while True:
    want = math.ceil(acc / k)
    if(want+acc > n):
        break
    acc += want
    ret += 1
print(ret)

Submission status: Accepted

Solution code:
N, K = (int(x) for x in input().split())

t = 1
r = N - 1
s = 1

while True:
    b = s // K + 1 if s % K else s // K
    if r >= b:
        r -= b
        s += b
        t += 1
    else:
        break

print(t)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
weight = 1
rest = n - 1
layers = 1
while True:
  add = weight // k + bool(weight % k)
  if add <= rest:
    rest -= add
    weight += add
    layers += 1
  else:
    break
print(layers)