#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
template <class T>
T Gcd(T x, T y) {
  return y ? Gcd(y, x % y) : x;
}
template <class T>
T Lcm(T x, T y) {
  return x / Gcd(x, y) * y;
}
template <class T>
void Adj(T &x, T y) {
  if (x >= y) x %= y;
  while (x < 0) x += y;
}
const long long MOD = 998244353LL;
const int M = 10000005;
const int N = 100005;
long long n, m, ans, k, t;
inline bool judge(long long x) {
  t = (x + 1LL) * x / 2LL;
  if (x > m) t += (m + x - 1LL) * (x - m) / 2LL;
  return t <= n ? true : false;
}
inline long long bs(long long l, long long r) {
  long long res = 0;
  while (l <= r) {
    long long mid = (l + r) >> 1;
    if (judge(mid))
      res = mid, l = mid + 1LL;
    else
      r = mid - 1LL;
  }
  return res;
}
int main() {
  scanf("%I64d %I64d", &n, &m);
  k = bs(1LL, 1500000000LL);
  t = (k + 1LL) * k / 2LL;
  if (k > m) t += (m + k - 1LL) * (k - m) / 2LL;
  n -= t;
  ans = k;
  if (k > m) ans += k - m;
  ans += n / k;
  if (n % k) ans++;
  printf("%I64d\n", ans);
  return 0;
}
