#include <bits/stdc++.h>
using namespace std;
long long n, k;
inline long long Max(long long a, long long b) { return (a > b) ? a : b; }
inline long long Abs(long long x) { return (x > 0) ? x : (-x); }
inline long long sigma(long long a, long long b) {
  return (a + b) * (Abs(b - a) + 1) / 2;
}
bool ctrl(long long x) {
  long long ans;
  if (x <= k)
    ans = sigma(1, x);
  else {
    ans = sigma(1, k - 1);
    x -= k;
    if (x & 1)
      ans += sigma(k, k + (x >> 1)) + sigma(k + (x >> 1), k);
    else
      ans += sigma(k, k + (x >> 1)) + sigma(k + (x >> 1) - 1, k);
  }
  return ans >= n;
}
int main() {
  scanf("%I64d%I64d", &n, &k);
  long long l = 0, r = 2 * sqrt(n) + 2;
  while (l < r - 1) {
    long long mid = l + r >> 1;
    if (!ctrl(mid))
      l = mid;
    else
      r = mid;
  }
  printf("%I64d", r);
  return 0;
}
