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++: #define _AOJ_
#include "bits/stdc++.h"
using namespace std;
typedef long long i64;
#define rep(i,n) for(int i=0;i<n;++i)
#define REP(i,a,b) for(int i=a;i<b;++i)
#define all(c) c.begin(),c.end()

//define pfs,bellmanford,etc.

int main(){
	i64 n,k;cin>>n>>k;
	i64 s=1,ans=1;
	vector<i64>a(1,1);
	while(s<=n){
		a.push_back((s+k-1)/k);
		s+=a.back();
		if(s<=n)ans=a.size();
	}
	cout<<ans<<endl;
}

//sub-EOF

C++: #include "bits/stdc++.h"
#define rep(var,cnt) for(int (var)=0; (var)<(cnt); ++(var))

using namespace std;

using int64 = int64_t;

using pi=pair<int,int>;

template <int mod>
struct ModInt {
	int x;
	ModInt() : x(0) {}
	ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
	ModInt &operator+=(const ModInt &p) {
		if((x += p.x) >= mod) x -= mod;
		return *this;
	}
	ModInt &operator-=(const ModInt &p) {
		if((x += mod - p.x) >= mod) x -= mod;
		return *this;
	}
	ModInt &operator*=(const ModInt &p) {
		x = (int)(1ll * x * p.x % mod);
		return *this;
	}
	ModInt &operator/=(const ModInt &p) {
		*this *= p.inverse();
		return *this;
	}
	ModInt operator-() const {return ModInt(-x);}
	ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
	ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
	ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
	ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
	bool operator==(const ModInt& p) const {return x == p.x; }
	bool operator!=(const ModInt& p) const {return x != p.x; }
	ModInt inverse() const {
		int a = x, b = mod, u = 1, v = 0, t;
		while(b > 0) {
			t = a / b;
			swap(a -= t * b, b);
			swap(u -= t * v, v);
		}
		return ModInt(u);
	}
	ModInt pow(int64_t n) const {
		ModInt ret(1), mul(x);
		while(n > 0) {
		if(n & 1) ret *= mul;
		mul *= mul;
		n >>= 1;
		}
		return ret;
	}
	friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x; }
};

const int MOD = 1e9 + 7;

int main() {
	int64 N, K; cin >> N >> K;
	int64 sum = 0;
	int64 ans = 0;
	while(true) {
		int64 res = ceil(1.0 * (N - sum) / (K + 1));
		ans++;
		sum += res;
		if(N - sum == 0) break;
	}
	
	cout << ans << endl;
}

C++: #include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define MMP(a, b, c) make_pair(make_pair(a, b), c)
#define MAX 1000000000
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define PI 3.14159265359

#include <boost/multiprecision/cpp_int.hpp>
namespace boost_multiprecision = boost::multiprecision;
#define CINT boost_multiprecision::cpp_int

int main(){
    iostream::sync_with_stdio(false);
    
    int N, K;
    cin >> N >> K;
    int wa = 1;
    int ans = 1;
    N--;
    int tmp = 1;
    while(N >= tmp){
        if((double)wa/tmp <= K){
            wa += tmp;
            N -= tmp;
            ans++;
        }
        else{
            if(tmp > 0) tmp++;
            else break;
        }
    }
    cout << ans << endl;
    
    return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;
using llong = long long;
using ldbl = long double;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	llong N, K;
	cin >> N >> K;
	llong now = 1, ans = 1;
	N--;
	while(true){
		llong next = now/K + (now%K>0);
		if(N < next)
			break;
		now += next;
		N -= next;
		ans++;
	}

	cout << ans << endl;

	return 0;
}

C++: #include<stdio.h>
#include<stdlib.h>
int main(){
  int towerh = 1,maxyoko,yoko=1,taikyu,taikyutemp,blockcnt = 1;
  scanf(" %d %d",&maxyoko,&taikyu);
  taikyutemp = taikyu;
  while(1){
    if(maxyoko + 1 == yoko)break;
    else if((blockcnt/yoko) > taikyutemp){
      yoko++;
      continue;
    }else{
      towerh++;
      taikyutemp -= (blockcnt / yoko);
      blockcnt += yoko;
    }
  }
  printf("%d\n",towerh);
  return 0;
  }

C++: #include "bits/stdc++.h"

#pragma warning(disable:4996)
using namespace std;


int main() {
	int N,K;cin>>N>>K;
	int ans=0;
	int sum=0;
	while (true) {
		int next=(sum-1)/K+1;
		if(ans==0)next=1;
		if (N < sum + next) {
			break;
		}
		else {
			sum+=next;
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

C++: #include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>

bool valid(int N, int K, int x) {
  int wsum = 1;
  for (int i = 1; i < x; ++i) {
    int n = (wsum+K-1) / K;
    wsum += n;
    if (wsum > N) return false;
  }
  return wsum <= N;
}

int main() {
  int N, K;
  scanf("%d %d", &N, &K);

  int lb = 1;
  int ub = N+1;
  while (ub-lb > 1) {
    int mid = (lb+ub) >> 1;
    (valid(N, K, mid)? lb:ub) = mid;
  }
  printf("%d\n", lb);
}

C++: #include <iostream>
#include <algorithm>

using namespace std;

class Solver {
public:
	static void solve() {
		int n, k;
		cin >> n >> k;
		int now = 1;
		n--;
		int sum = 1;
		while (true) {
			int need = sum / k;
			if (sum % k > 0)need++;

			if (n < need)break;

			now++;
			sum += need;
			n -= need;
		}

		cout << now << endl;
	}
};

int main() {
	Solver::solve();
}

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

int main() {
    int n,k,t=0,ans=0,u=1;
    cin >> n >> k;
  while (true) {
      if (n-t<u) break;
      if (u*k>=t) {t+=u;ans++;}
      else {u++;continue;}
  }
  cout << ans << endl;
}

C++: //yukicoder@cpp14
//author:luckYrat(twitter:@luckYrat_)
//<ここに一言>

//せんげん！
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <bitset>

#include <cctype>
#include <utility>
#include <climits>


//なまえくーかん！
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

//てーすう！
const int mod = 1000000007;
const int inf = (1<<30)-1;
const ll linf = (1LL<<62LL)-1;
const double EPS = (1e-10);

//でふぁいん！
#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)

//みじかく！
#define pb push_back
#define fir first
#define scn second
#define ednl endl

//いぇすのー！
#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")

//きんぼーnほーこー！！
P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる

計算量は変わらないが楽できるシリーズ
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる
*/
template <typename T>
T gcd(T a,T b){
  if(a%b==0)return b;
  else return gcd(b,a%b);
}
template <typename T>
T lcm(T a,T b){
  return a/gcd(a,b)*b;
}
int dp[200][200];
struct z{
	int a,b,c;
};
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main(){
	int n,k;cin>>n>>k;
	int nw = 1;
	int z = 1;
	int ans = 1;
	while(n >= nw){
		while(nw > k*z){
			z++;
		}
		nw+=z;
		ans++;
	}
	cout << ans-1 << endl;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(){
  int n, k;
  cin >> n >> k;

  int ans = 1, t = 1;

  while((t += (t+k-1)/k) <= n) ans++;

  cout << ans << endl;

  return 0;
}