#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void amin(T &x, const T &y) {
  if (y < x) x = y;
}
template <class T>
inline void amax(T &x, const T &y) {
  if (x < y) x = y;
}
template <class Iter>
void rprintf(const char *fmt, Iter begin, Iter end) {
  for (bool sp = 0; begin != end; ++begin) {
    if (sp)
      putchar(' ');
    else
      sp = true;
    printf(fmt, *begin);
  }
  putchar('\n');
}
unsigned long long N, M;
unsigned long long safe(unsigned long long x, unsigned long long y) {
  if (x & 1)
    y >>= 1;
  else
    x >>= 1;
  long long r = 0;
  for (; y; y >>= 1) {
    if (y & 1) r = min(N, r + x);
    x = min(N, x + x);
  }
  return r;
}
bool ok(unsigned long long t) {
  if (N <= t) return false;
  if (t <= M) return true;
  return safe(t - M, t - M - 1) + t < N;
}
int main() {
  scanf("%llu %llu", &N, &M);
  amin(M, N);
  unsigned long long lo = 0, hi = 1;
  while (ok(hi)) hi <<= 1;
  while (hi - lo > 1) {
    unsigned long long mid = (lo + hi) / 2;
    (ok(mid) ? lo : hi) = mid;
  }
  printf("%llu\n", hi);
  return 0;
}
