#include <bits/stdc++.h>
using namespace std;
long long n, m;
bool check(long long lp) {
  if (lp <= m) {
    long double x = (long double)(1 + lp) * (long double)lp / 2;
    return x >= (long double)n;
  } else {
    long long x = lp - m - 1;
    long double y;
    if (x & 1)
      y = (long double)(x + 1) * (long double)(x + 1) / 4;
    else
      y = (long double)(x + 2) * (long double)x / 4;
    return (long double)(m + 1) * (long double)m / 2 +
               (long double)(lp - m) * (long double)m + y >=
           (long double)n;
  }
}
int main() {
  scanf("%lld%lld", &n, &m);
  long long l = 0, r = n, ans = 0;
  while (l <= r) {
    long long mid = (l + r) / 2;
    if (check(mid))
      ans = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  printf("%lld\n", ans);
  return 0;
}
