#include <bits/stdc++.h>
using namespace std;
using ii = pair<int, int>;
using ll = long long int;
using vi = vector<int>;
using graph = vector<vi>;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3f;
ll bbin(ll d, ll h, ll n) {
  ll ini = 0, fim = d, mid;
  ll am, p;
  ll ans = 0;
  while (ini <= fim) {
    mid = ini + fim >> 1;
    p = min(h, mid);
    if (mid * mid - (p * (p - 1) >> 1) >= n) {
      fim = mid - 1;
      ans = mid;
    } else {
      ini = mid + 1;
    }
  }
  p = min(ans, h);
  ll al = ans * ans - p * (p - 1) / 2;
  n -= al;
  return 2 * ans - p + (n) / ans;
}
int main() {
  ll n, m, k, h, d;
  scanf("%lld %lld", &n, &h);
  m = ceil(sqrt(n));
  d = m * 2LL - 1LL;
  printf("%lld\n", bbin(d, h, n));
}
