Go: package main

import "fmt"

func main() {
	var n, k int
	fmt.Scanln(&n, &k)
	height := 0
	weight := 0
	block := 1
	for n >= block {
		if weight <= k*block {
			height++
			n -= block
			weight += block
		} else {
			block++
		}
	}
	fmt.Println(height)
}

C++: #include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main(){
	int n,K;cin>>n>>K;
	int cnt=1,i=1;
	for(;;i++){
		int need=(cnt+K-1)/K;
		if(cnt+need>n)break;
		cnt+=need;
	}
	cout<<i<<endl;
}