Anton likes to listen to fairy tales, especially when Danik, Anton's best friend, tells them. Right now Danik tells Anton a fairy tale:

"Once upon a time, there lived an emperor. He was very rich and had much grain. One day he ordered to build a huge barn to put there all his grain. Best builders were building that barn for three days and three nights. But they overlooked and there remained a little hole in the barn, from which every day sparrows came through. Here flew a sparrow, took a grain and flew away..."

More formally, the following takes place in the fairy tale. At the beginning of the first day the barn with the capacity of n grains was full. Then, every day (starting with the first day) the following happens:  m grains are brought to the barn. If m grains doesn't fit to the barn, the barn becomes full and the grains that doesn't fit are brought back (in this problem we can assume that the grains that doesn't fit to the barn are not taken into account).  Sparrows come and eat grain. In the i-th day i sparrows come, that is on the first day one sparrow come, on the second day two sparrows come and so on. Every sparrow eats one grain. If the barn is empty, a sparrow eats nothing. 

Anton is tired of listening how Danik describes every sparrow that eats grain from the barn. Anton doesn't know when the fairy tale ends, so he asked you to determine, by the end of which day the barn will become empty for the first time. Help Anton and write a program that will determine the number of that day!


-----Input-----

The only line of the input contains two integers n and m (1 ≤ n, m ≤ 10^18) — the capacity of the barn and the number of grains that are brought every day.


-----Output-----

Output one integer — the number of the day when the barn will become empty for the first time. Days are numbered starting with one.


-----Examples-----
Input
5 2

Output
4

Input
8 1

Output
5



-----Note-----

In the first sample the capacity of the barn is five grains and two grains are brought every day. The following happens:  At the beginning of the first day grain is brought to the barn. It's full, so nothing happens.  At the end of the first day one sparrow comes and eats one grain, so 5 - 1 = 4 grains remain.  At the beginning of the second day two grains are brought. The barn becomes full and one grain doesn't fit to it.  At the end of the second day two sparrows come. 5 - 2 = 3 grains remain.  At the beginning of the third day two grains are brought. The barn becomes full again.  At the end of the third day three sparrows come and eat grain. 5 - 3 = 2 grains remain.  At the beginning of the fourth day grain is brought again. 2 + 2 = 4 grains remain.  At the end of the fourth day four sparrows come and eat grain. 4 - 4 = 0 grains remain. The barn is empty. 

So the answer is 4, because by the end of the fourth day the barn becomes empty.

Difficulty: MEDIUM_HARD

Solutions:
def get_empty_before_birds(m, i):
	if i <= m + 1:
		return 0
	t = i - (m + 1)
	return t * (t + 1) // 2

def get_total_empty_after_birds(m, i):
	return get_empty_before_birds(m, i) + i

def get_birds(m, n):
	(low, high) = (1, n)
	while True:
		i = (low + high) // 2
		if get_total_empty_after_birds(m, i) < n:
			low = i + 1
		elif get_total_empty_after_birds(m, i - 1) < n <= get_total_empty_after_birds(m, i + 1):
			return i
		else:
			high = i - 1

def main():
	(n, m) = [int(t) for t in input().split()]
	print(get_birds(m, n))
main()


R = lambda : map(int, input().split())
(n, m) = R()
if m >= n:
	print(n)
else:
	(l, r) = (0, n)
	while l < r:
		mid = (l + r) // 2
		if (2 * m + 2 + mid) * (mid + 1) // 2 >= n + mid * m:
			r = mid
		else:
			l = mid + 1
	print(m + r + 1)


(n, m) = [int(x) for x in input().split()]
if m >= n:
	print(n)
	return
L = m
R = n
while L + 1 < R:
	M = (L + R) // 2
	z = M - m
	if z * (z - 1) // 2 + M >= n:
		R = M
	else:
		L = M
print(R)


(n, m) = map(int, input().strip().split(' '))
low = 1
high = n
ans = 1000000000000000000000000000
if n > m:
	while low <= high:
		mid = (high + low) // 2
		t = mid * (mid + 1) // 2 + m
		if t >= n:
			ans = min(ans, mid)
			high = mid - 1
		else:
			low = mid + 1
	print(m + ans)
else:
	print(n)


(n, m) = list(map(int, input().strip().split()))

def quad_solve(a, b, c):
	x = b ** 2 - 4 * a * c
	return (-b + x ** 0.5) / 2
if n <= m:
	print(n)
else:
	aM = m
	n -= m
	(l, r) = (0, int(2000000000.0))
	while l < r:
		m = (l + r) // 2
		val = m * (m + 1) // 2
		if val >= n:
			r = m
		else:
			l = m + 1
	print(l + aM)


import sys
(n, m) = input().split()
n = int(n)
m = int(m)
ans = m
if m >= n:
	print(n)
	sys.exit(0)
high = 10 ** 20
low = 1
dif = n - m
while high - low > 5:
	mid = high + low >> 1
	if (1 + mid) * mid >> 1 >= dif:
		high = mid
	else:
		low = mid
mid = max(0, mid - 10)
while (1 + mid) * mid >> 1 < dif:
	mid += 1
ans += mid
print(ans)


(n, m) = map(int, input().rstrip().split())
if n <= m:
	print(n)
else:
	ans = m
	n -= m
	left = 0
	right = n + 1
	while right - left > 1:
		mid = left + (right - left) // 2
		if n <= (mid + 1) * mid // 2:
			right = mid
		else:
			left = mid
	print(ans + right)


(n, m) = list(map(int, input().split()))
if m >= n:
	print(n)
else:
	start = n - m + 1
	r = 10 ** 11
	l = -1
	while r - l > 1:
		mid = (l + r) // 2
		summ = mid * (mid + 1) // 2
		if summ >= n - m:
			r = mid
		else:
			l = mid
	print(r + m)


(n, m) = list(map(int, input().split()))
if n <= m:
	print(n)
	exit()
l = 0
r = 10 ** 19
while r > l + 1:
	k = (l + r) // 2
	if n - (k - 1) * k // 2 - (m + k) > 0:
		l = k
	else:
		r = k
print(m + r)


import sys
(n, m) = map(int, input().split())
l = m + 1
r = n + 1
ans = n
if n == 1:
	ans = 1
elif m < n:
	while l <= r:
		i = (l + r) // 2
		y = 2 * m + (i - m) * (i - m + 1)
		x = 2 * n
		if y >= x:
			ans = i
			r = i - 1
		else:
			l = i + 1
else:
	ans = n
print(int(ans))


(n, m) = map(int, input().split())

def calc(n):
	return (n + 1) * n // 2
if n <= m:
	print(n)
else:
	ans = m
	l = 0
	r = n - m
	while l < r - 1:
		mid = (l + r) // 2
		if calc(mid) >= n - m:
			r = mid
		else:
			l = mid
	if calc(l) >= n - m:
		r = l
	ans += r
	print(ans)


import math
(n, m) = map(int, input().split())
if m >= n:
	print(n)
else:
	temp = min(n, m)
	a = temp + 1
	res = temp
	start = 0
	end = 2 * 10 ** 9
	while start <= end:
		mid = (start + end) // 2
		if mid * (2 * a + mid - 1) // 2 > n + (mid - 1) * m:
			end = mid - 1
		elif mid * (2 * a + mid - 1) // 2 < n + (mid - 1) * m:
			start = mid + 1
		else:
			start = mid
			break
	print(start + res)


import math
(n, m) = input().split()
n = int(n)
m = int(m)
ans = min(n, m)
n -= m
n = max(n, 0)
x = 0
lo = 1
hi = n
x = hi
while lo < hi:
	mid = (lo + hi) // 2
	if mid * (mid + 1) < n * 2:
		lo = mid + 1
	else:
		hi = mid
		x = mid
ans += x
print(ans)


def sum_(x):
	return x * (x + 1) // 2
(n, m) = map(int, input().split())
(low, high, mid, ans, end_day) = (0, int(2000000000.0), 0, 0, 0)
if n <= m:
	ans = n
else:
	while low <= high:
		mid = (high + low) // 2
		end_day = sum_(mid) + m
		if end_day >= n:
			ans = mid
			high = mid - 1
		else:
			low = mid + 1
	ans += m
print(ans)


def r():
	return list(map(int, input().split()))
(n, m) = r()
if n <= m:
	print(n)
	exit()
(l, r) = (0, n + 1)
while l < r - 1:
	mid = (l + r) // 2
	if n - mid * (mid + 1) // 2 <= m:
		r = mid
	else:
		l = mid
print(r + m)


(n, m) = map(int, input().split())
if n <= m:
	print(n)
else:
	l = m - 1
	r = int(2e+18)
	while r - l > 1:
		mid = (r + l) // 2
		if n - (mid - 1 - m) * (mid - m) // 2 <= mid:
			r = mid
		else:
			l = mid
	print(r)


import math
l = [int(x) for x in str(input()).split(' ')]
n = l[0]
m = l[1]
if m >= n:
	print(n)
else:
	a = 1 + 8 * (n - m)
	b = int(math.sqrt(a))
	if b * b < a:
		b = b + 1
	print(m + math.ceil(b / 2 - 0.5))


from math import sqrt, floor
s = input().split()
n = int(s[0])
m = int(s[1])
if m > n:
	m = n
r = (sqrt(1 + 8 * (n - m)) - 1) / 2
k = floor(r)
for i in range(k - 1, k + 3):
	if i * (i + 1) >= 2 * (n - m):
		x = i
		break
print(m + max(0, x))


(n, m) = [int(x) for x in input().split()]

def b_search(left, right):
	if left == right:
		return left
	middle = (left + right) // 2
	_l = 2 * (n + m * (middle - m - 1))
	_r = (m + 1 + middle) * (middle - m)
	holds = _l <= _r and _r >= 0 and (_l >= 0)
	if not holds:
		return b_search(middle + 1, right)
	else:
		return b_search(left, middle)
print(min(b_search(1, 10 ** 18 + 3), n))


def discards(m, k):
	alls = m * (m + 1) // 2
	if k > m:
		return alls
	k = m - k
	k = k * (k + 1) // 2
	return alls - k

def solve(n, m, k):
	cantake = k * (k + 1) // 2
	grain = n + m * k
	grain = grain - discards(m, k)
	return grain <= cantake

def fast(n, m):
	l = 1
	r = n
	res = n + 1
	while l <= r:
		if l == r:
			if solve(n, m, l):
				res = min(res, l)
			break
		mm = (l + r) // 2
		if solve(n, m, mm):
			r = mm - 1
			res = min(res, mm)
		else:
			l = mm + 1
	return res
(n, m) = map(int, input().split())
print(fast(n, m))


a = list(map(int, input().split()))
n = a[0]
m = a[1]

def calc(p):
	if p <= m:
		return 1
	return n - (p - m - 1) * (p - m) // 2 - p

def bs(st, en):
	if en - st <= 1:
		if calc(st) <= 0:
			return st
		return en
	mid = (en + st) // 2
	if calc(mid) <= 0:
		return bs(st, mid)
	return bs(mid, en)
m = min(m, n)
print(bs(1, n))


import sys
(n, m) = map(int, input().split())
m = min(n, m)
if n == 1:
	print(1)
	sys.exit()

def bsearch(l, r):
	if l > r:
		return l
	d = (l + r) // 2
	cur = n + (m - 1) * m // 2 + (d - m) * m
	cur2 = d * (d + 1) // 2
	if cur2 >= cur:
		return bsearch(l, d - 1)
	return bsearch(d + 1, r)
d = bsearch(m, 10 ** 20)
cur = n + (m - 1) * (m + 1) // 2 + (d - m) * m
cur2 = d * (d + 1) // 2
print(d)


import math as mt
import sys, string
input = sys.stdin.readline
from collections import defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())

def sigma(x):
	return x * (x + 1) // 2

def check(n, m, x):
	if sigma(x) < n:
		return True
	else:
		return False
(n, m) = M()
ans = min(n, m)
n -= min(n, m)
if n == 0:
	print(ans)
else:
	l = 1
	h = 10
	mid = l + (h - l + 1) // 2
	while check(n, m, h):
		l *= 10
		h *= 10
	ans2 = 0
	while l < h:
		mid = l + (h - l + 1) // 2
		if check(n, m, mid):
			l = mid
			ans2 = l
		else:
			h = mid - 1
	if check(n, m, l):
		ans2 = l
	print(ans2 + ans + 1)


(n, m) = map(int, input().split())
if n <= m:
	print(n)
else:
	(low, high) = (0, n - m)
	while low < high:
		mid = low + high >> 1
		if (1 + mid) * mid < 2 * (n - m):
			low = mid + 1
		else:
			high = mid
	print(low + m)


from decimal import *
getcontext().prec = 28
L = input().split()
n = Decimal(L[0])
m = Decimal(L[1])
if m >= n:
	print(n)
else:
	from math import ceil
	k = Decimal(0.5)
	a = (1 + 8 * (n - m)) ** k
	print(int(ceil((-1 + a) / Decimal(2)) + m))


(n, m) = map(int, input().split())
tl = m
tr = n
while tr - tl > 1:
	mid = (tr + tl) // 2
	val = (mid - m) * (mid - m + 1) // 2
	bef = (mid - m) * (mid - m - 1) // 2
	if val >= n or n - bef <= mid:
		tr = mid
	else:
		tl = mid
print(tr)


(a, b) = map(int, input().split())
if a <= b:
	print(a)
else:
	c = b
	d = a
	while c < d:
		x = (c + d) // 2
		if (b * (x - b) + (a - b)) * 2 - (b + 1 + x) * (x - b) <= 0:
			d = x
		else:
			c = x + 1
	print(c)


def solution():
	(n, m) = map(int, input().split())
	ans = n
	(lo, hi) = (m + 1, 10 ** 30)
	while lo != hi:
		mid = (lo + hi) // 2
		if 2 * m + (mid - m) * (mid - m + 1) < 2 * n:
			lo = mid + 1
		else:
			hi = mid
	ans = min(ans, lo)
	print(ans)
solution()


from math import ceil
from decimal import Decimal
(n, m) = map(int, input().split())
barn = n
if n <= m:
	print(n)
else:
	days = ceil((-1 + Decimal(1 + 8 * (n - m)) ** Decimal(0.5)) / 2)
	print(days + m)


(n, m) = map(int, input().split())
if n <= m:
	print(n)
else:
	ans = 0
	n -= m
	L = 1
	R = 1000000000000000000
	while L <= R:
		mid = (L + R) // 2
		if mid * (mid + 1) // 2 >= n:
			ans = mid
			R = mid - 1
		else:
			L = mid + 1
	print(ans + m)


(n, m) = map(int, input().split())
l = m
r = 2 * 10 ** 18 + 20
while l < r:
	k = (l + r) // 2
	num = (k - m) * (k + m + 1) // 2 - (k - m - 1) * m
	if num < n:
		l = k + 1
	else:
		r = k
if n <= m:
	print(n)
else:
	print(l)


(n, m) = input().split()
n = int(n)
m = int(m)
if m >= n or (n - m - 1) * (n - m) < 2 * (n - m):
	m = n
	print(n)
else:
	a = 2 * (n - m)
	u = 1
	l = n - 1 - m
	while u != l:
		mid = (u + l) // 2
		if mid * (mid + 1) >= a:
			if (mid - 1) * mid < a:
				break
			else:
				l = mid - 1
		elif (mid + 1) * (mid + 2) >= a:
			mid += 1
			break
		else:
			u = mid + 1
	print(mid + m)


import math
(n, m) = map(int, input().split())
if m >= n:
	print(n)
	exit()
r = n - m
s = max(0, math.ceil((math.sqrt(1 + 8 * r) - 1) / 2) - 10)
for i in range(0, 21):
	ss = s + i
	if ss * (ss + 1) >= 2 * r:
		break
print(m + ss)


(n, m) = map(int, input().split())
if n <= m:
	print(n)
else:
	aM = m
	n -= m
	(l, r) = (0, int(2000000000000000.0))
	while l < r:
		m = (l + r) // 2
		val = m * (m + 1) // 2
		if val >= n:
			r = m
		else:
			l = m + 1
	print(l + aM)


(n, m) = input().split()
n = int(n)
m = int(m)
l = 0
r = 10 ** 19
mid = 0
if n <= m:
	print(n)
else:
	while l + 1 < r:
		mid = (l + r) // 2
		if mid < m:
			l = m
		else:
			q = mid - m
			q = q * (q + 1) // 2
			if n - m - q > 0:
				l = mid
			else:
				r = mid
	print(r)


import sys
import math

def count_day():
	(n, m) = str(sys.stdin.readline()).split()
	(n, m) = (int(n), int(m))
	if n <= m:
		return n
	min_k = math.floor(math.sqrt(2 * (n - m))) - 1
	max_k = 1 + math.ceil(math.sqrt(2 * (n - m)))
	for k in range(min_k, max_k):
		if k * (k + 1) >= 2 * (n - m):
			return m + k
day = count_day()
print(day)


(n, d) = map(int, input().split())
l = 1
r = int(1e+18)
if n == d:
	exit(print(d))
while r - l > 1:
	m = l + (r - l) // 2
	m1 = max(0, m - d)
	res = n - m1 * (m1 - 1) // 2 - m
	if res < 0:
		r = m
	elif res > 0:
		l = m
	else:
		r = m
		break
print(1 if n == 1 else r)


def binary_search_first_true(predicate, from_inclusive, to_inclusive):
	lo = from_inclusive - 1
	hi = to_inclusive + 1
	while hi - lo > 1:
		mid = (lo + hi) // 2
		if not predicate(mid):
			lo = mid
		else:
			hi = mid
	return hi

def tri(n):
	return n * (n + 1) // 2

def f(n, m, t):
	return n - tri(t - m - 1) - t

def solve(n, m):
	if m >= n:
		return n
	ans = binary_search_first_true(lambda x: f(n, m, x) <= 0, m + 1, n)
	return ans

def main(sc):
	(n, m) = sc.next_ints(2)
	ans = solve(n, m)
	print(ans)

class Scanner:

	def __init__(self):
		self.idx = 0
		self.tokens = []

	def __next__(self):
		while self.idx == len(self.tokens) or not len(self.tokens[self.idx]):
			if self.idx == len(self.tokens):
				self.idx = 0
				self.tokens = input().split()
			else:
				self.idx += 1
		self.idx += 1
		return self.tokens[self.idx - 1]

	def next_string(self):
		return next(self)

	def next_strings(self, n):
		return [self.next_string() for i in range(0, n)]

	def next_int(self):
		return int(next(self))

	def next_ints(self, n):
		return [self.next_int() for i in range(0, n)]
scanner = Scanner()
main(scanner)


(n, m) = map(int, input().split())
l = 0
r = 10 ** 18 + 1

def can(mid):
	if mid <= m:
		return n - mid > 0
	plus = n - m - (mid - m) * (mid - m + 1) // 2
	return plus > 0
while r - l > 1:
	mid = (l + r) // 2
	if can(mid):
		l = mid
	else:
		r = mid
print(r)


import sys
(n, m) = map(int, input().split())
if n <= m:
	print(n)
	sys.exit(0)
else:
	(l, r) = (m + 1, n)
	base = m * (m - 1) // 2
	while l != r:
		mid = (l + r) // 2
		plus = n + base + (mid - m) * m
		minus = mid * (mid + 1) // 2
		if plus > minus:
			l = mid + 1
		else:
			r = mid
	print(l)


(n, m) = map(int, input().split())
till = m + 1
two = 2
one = 1

def kotoase(x):
	if x <= till:
		return n
	day = x - till
	return n + day * m - (day * (day - one) >> one) - day * till
high = n
low = 1
mid = 0
Ans = n
while low <= high:
	mid = high + low >> one
	if kotoase(mid) <= mid:
		Ans = mid
		high = mid - one
	else:
		low = mid + one
print(Ans)


(n, m) = map(int, input().split())
if n <= m:
	print(n)
else:
	(l, r) = (0, int(2000000000.0))
	while l < r:
		mi = (l + r) // 2
		val = mi * (mi + 1) // 2
		if n - val <= m:
			r = mi
		else:
			l = mi + 1
	print(l + m)


import math
str = input().split()
n = int(str[0])
m = int(str[1])
if m >= n:
	print(n)
else:
	k = -0.5 + math.sqrt(0.5 * 0.5 - 2 * (m - n))
	tmp = int(math.sqrt(1 - 8 * (m - n)))
	k = int(k) + (tmp * tmp < 1 - 8 * (m - n))
	if n > m + k:
		print(m + k)
	else:
		print(n)


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right
import time
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict as dd, deque as dq, Counter as dc
import math, string
start_time = time.time()

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())

def getMat(n):
	return [getInts() for _ in range(n)]
MOD = 10 ** 9 + 7

def solve():
	(N, M) = getInts()
	if M >= N:
		return N
	left = 0
	right = 10 ** 18 + 1

	def works(X):
		return X * (X + 1) // 2 >= N - M
	while right - left > 1:
		mid = (left + right) // 2
		if works(mid):
			right = mid
		else:
			left = mid
	return M + right
print(solve())


(n, m) = map(int, input().split())
sm = lambda x: x * (x + 1) // 2
diff = lambda x: sm(x) - sm(m)
if m >= n:
	print(n)
	exit()
ans = m
(l, r) = (ans + 1, n)
while l < r:
	mid = (l + r) // 2
	if diff(mid) >= n + (mid - m - 1) * m:
		r = mid
	else:
		l = mid + 1
print(l)


(n, m) = list(map(int, input().split()))
l = -1
r = int(1e+18 + 10)
while r - l != 1:
	t = (r + l) // 2
	eaten = t
	if t - 1 > m:
		eaten += (t - 1 - m) * (t - m) // 2
	if eaten >= n:
		r = t
	else:
		l = t
print(r)


import math
from decimal import Decimal
(n, m) = input().split()
n = int(n)
m = int(m)
i = 0
if n <= m:
	i = n
else:
	i = math.sqrt((n - m) * 8)
	i = m + math.ceil((-1 + Decimal(1 + 8 * (n - m)) ** Decimal(0.5)) / 2)
print(i)


def f(n, m):
	if n <= m:
		return n
	aM = m
	n -= m
	(l, r) = (0, int(2000000000.0))
	while l + 1 < r:
		m = (l + r) // 2
		val = m * (m + 1) // 2
		if val >= n:
			r = m
		else:
			l = m
	return l + 1 + aM
(n, m) = map(int, input().split())
print(f(n, m))


(n, m) = map(int, input().split())
if n <= m + 1:
	print(n)
else:
	l = m - 1
	r = n + 1
	while l + 1 != r:
		mm = (l + r) // 2
		if (mm - m) * (mm - m - 1) // 2 + mm >= n:
			r = mm
		else:
			l = mm
	print(r)


(n, m) = list(map(int, input().split()))
if m >= n - 1:
	print(n)
else:
	l = 0
	r = 10 ** 18
	while r - l > 1:
		md = (l + r) // 2
		now = min(md, m - 1)
		now = now * (now + 1) // 2 + max(0, md - m) * m
		if n - md * (md + 1) // 2 + now <= 0:
			r = md
		else:
			l = md
	print(r)


import math

def bin_pow(a, b):
	ans = 1
	while b > 0:
		if b & 1 == 1:
			ans *= a
		a *= a
		b >>= 1
	return ans
(n, m) = map(int, input().split())
if m >= n:
	print(n)
else:
	ans = m
	n -= m
	left = 0
	right = int(1e+19)
	while left <= right:
		mid = (left + right + 1) // 2
		if mid * (mid + 1) > 2 * n:
			right = mid - 1
		elif mid * (mid + 1) < 2 * n:
			left = mid + 1
		else:
			print(ans + mid)
			exit(0)
	while mid * (mid + 1) >= 2 * n:
		mid -= 1
	while mid * (mid + 1) < 2 * n:
		mid += 1
	print(ans + mid)


(n, m) = map(int, input().split())
if n <= m:
	print(n)
else:
	lo = 1
	hi = int(2000000000.0)
	while lo < hi:
		mid = (lo + hi) // 2
		val = (mid + 1) * mid // 2
		val1 = (mid - 1) * mid // 2
		if n - val > m:
			lo = mid
		elif n - val < m and n - val1 < m:
			hi = mid
		else:
			break
	if n - val1 <= m:
		print(m + mid - 1)
	elif n - val <= m:
		print(m + mid)


(n, m) = [int(i) for i in input().split()]
if m >= n:
	print(n)
else:
	l = 1
	r = n
	while l != r:
		cur = (l + r) // 2
		if (1 + cur) * cur // 2 >= n - m:
			r = cur
		else:
			l = cur + 1
	print(m + l)


import math
from decimal import Decimal
(a, b) = map(int, input().split())
if a <= b:
	print(a)
else:
	ans = math.ceil((-1 + Decimal(1 + 8 * (a - b)) ** Decimal(0.5)) / 2)
	print(ans + b)


(n, m) = (int(x) for x in input().split())
if n <= m:
	print(n)
else:
	x = n - m
	(l, r) = (1, n)
	while l != r:
		mid = (l + r) // 2
		x_m = mid * (mid + 1) // 2
		if x_m == x:
			l = r = mid
		elif x_m < x:
			l = mid + 1
		else:
			r = mid
	print(l + m)


def main():
	(n, m) = map(int, input().split())
	if n <= m:
		print(n)
		return

	def func(k):
		return n + (k - m - 1) * m + m * (m + 1) // 2 - k * (k + 1) // 2
	(start, end) = (m + 1, n)
	while start < end:
		middle = (start + end) // 2
		if func(middle) <= 0:
			end = middle
		else:
			start = middle + 1
	print(end)
main()


def check(mid):
	return n - mid * (mid + 1) // 2 <= m
(n, m) = map(int, input().split())
low = 1
high = 10 ** 36
tot = max(m * (m - 1) // 2, n)
while low < high and high - low >= 3:
	mid = (low + high) // 2
	st = check(mid)
	if st:
		high = mid
	else:
		low = mid
ans = high + 1
for i in range(low, high + 1):
	st = check(i)
	if st:
		ans = min(ans, i)
if m < n:
	print(ans + m)
else:
	print(n)


import decimal
(n, m) = map(int, input().split())
if n <= m:
	print(n)
else:
	decimal.getcontext().rounding = decimal.ROUND_CEILING
	print(((decimal.Decimal(1 + 8 * (n - m)).sqrt() - 1) / 2 + m).to_integral_exact())


(n, m) = map(int, input().split())
if m >= n:
	print(n)
else:
	(lo, hi) = (0, int(2000000000.0))
	ans = 0
	while lo < hi:
		mid = (lo + hi) // 2
		tmp = mid * (mid + 1) // 2
		if n - m - tmp <= 0:
			hi = mid
		else:
			lo = mid + 1
	print(lo + m)


toi = int
inp = input
printf = print
(n, m) = [toi(x) for x in inp().split()]
if m >= n:
	printf(n)
	exit(0)
l = m
r = n
d = 0
val = 0
goal = 0
while r - l > 0:
	d = l + (r - l) // 2
	val = d * (d + 1) // 2 - m * (m + 1) // 2
	goal = n + m * (d - m - 1)
	if val >= goal:
		r = d
	else:
		l = d + 1
printf(l)


(n, m) = list(map(int, input().split()))
if m >= n:
	print(n)
else:
	k = n - m
	(low, high) = (m, n)
	l = float('inf')
	while low <= high:
		mid = (low + high) // 2
		p = k + (mid - m) * m
		q = (mid - m) * (2 * (m + 1) + (mid - m - 1)) // 2
		if q >= p:
			l = min(l, mid)
			high = mid - 1
		else:
			low = mid + 1
	print(l)


(n, m) = map(int, input().split())
if n <= m:
	print(n)
	return
tl = m
tr = n
while tr - tl > 1:
	tm = (tl + tr) // 2
	cnt = tm * (tm + 1) // 2 - m * (m + 1) // 2
	cur = n + (tm - m - 1) * m - cnt
	if cur <= 0:
		tr = tm
	else:
		tl = tm
print(tr)


l = list(map(int, input().split()))
n = l[0]
m = l[1]
if m >= n:
	print(n)
else:
	x = (8 * n - 8 * m + 1) ** 0.5 / 2 - 0.5
	y = int(x)
	a = 1
	if y ** 2 + y >= 2 * n - 2 * m:
		a = 0
	print(m + y + a)


(n, m) = [int(s) for s in input().split()]
lb = 0
ub = n
while ub - lb > 1:
	i = (lb + ub) // 2
	x = n - i
	if i > m:
		x = n - m + (i - m) * m - (i - m) * (m + 1 + i) // 2
	if x <= 0:
		ub = i
	else:
		lb = i
print(ub)


(cap, gr) = [int(i) for i in input().split()]
if gr > cap:
	gr = cap
days = gr
barn = cap - gr
n = max(int(((1 + 8 * barn) ** 0.5 - 1) / 2) - 1000, 0)
while n * (n + 1) // 2 < barn:
	n += 1
print(days + n)


import math
s = input().split()
n = int(s[0])
m = int(s[1])
if n <= m:
	print(n)
else:
	mid = 1 + 8 * (n - m)
	smid = int(math.sqrt(mid))
	if smid * smid >= mid:
		x = math.ceil((-1 + smid) / 2)
	else:
		x = math.ceil((-1 + smid + 1) / 2)
	print(m + x)


from decimal import *
(n, m) = [int(x) for x in input().split()]
if m >= n:
	print(n)
else:
	days = Decimal((-1 + Decimal(1 + 8 * (n - m)) ** Decimal(0.5)) / 2)
	answer = days.to_integral_exact(rounding=ROUND_CEILING) + m
	print(answer)


def func(l):
	return l * m + n - (m + 1 + l) * (m + 2 + l) // 2 + (m + 1) * m // 2
from math import ceil
(n, m) = [int(x) for x in input().split()]
if m >= n:
	print(n)
else:
	l = ceil((-3 + (9 - 8 * (m + 1 - n)) ** 0.5) / 2)
	for i in range(l - 1, l + 10):
		if func(i) <= 0:
			print(m + 1 + i)
			break


(n, m) = [int(x) for x in input().split()]
(l, r) = (m, n)
if m > n:
	print(n)
	exit()
for x in range(65):
	i = (l + r) // 2
	t = m * (i - m) - (i - m + 1) * (i + m) // 2
	if n + t <= 0:
		r = i
	else:
		l = i
print(r)


(n, m) = map(int, input().split())
if m >= n:
	print(n)
	exit(0)
(l, r) = (0, n)
while l < r:
	x = (l + r) // 2
	if x * (x + 1) // 2 + m >= n:
		r = x
	else:
		l = x + 1
print(m + l)


def f(n, m, da):
	if da <= m:
		return n - da
	else:
		da -= m
		end_m = n - m
		return end_m - da * (da + 1) // 2

def main():
	(n, m) = map(int, input().split())
	if f(n, m, 1) > 0:
		l = 1
		r = 10 ** 18
		while l + 1 < r:
			me = (l + r) // 2
			if f(n, m, me) > 0:
				l = me
			else:
				r = me
		print(r)
	else:
		print(1)
main()


(N, M) = map(int, input().split())
if N <= M:
	print(N)
else:
	low = M + 1
	high = 1000000000000000000
	while high - low > 0:
		mid = (low + high) // 2
		if N + (mid - (M + 1)) * M - (mid - M) * (M + 1 + mid) // 2 <= 0:
			high = mid
		else:
			low = mid + 1
	print(low)


(n, m) = map(int, input().split())

def binSearch(n, m):
	lo = 1
	hi = n
	p = -1
	S = 0
	while lo <= hi:
		k = (lo + hi) // 2
		S = (k - 1) * (k + 2) // 2
		S += m + 1
		if n - S > 0:
			lo = k + 1
		else:
			p = k
			hi = k - 1
	return p
if m >= n:
	print(n)
else:
	print(m + binSearch(n, m))


import math

def check(m, x, y):
	num = (x - y) * m + n - y
	p = x * (x + 1) // 2 - y * (y + 1) // 2
	if p < num:
		return 1
	else:
		return 0
(n, m) = map(int, input().split())
if n <= m:
	print(n)
else:
	L = m
	R = 1000000000000000000
	while L < R:
		mid = (L + R) // 2
		if check(m, mid, m) == 0:
			R = mid
		else:
			L = mid + 1
	print(L)


def find(l, r, kf):
	while l < r:
		m = (l + r) // 2
		if not kf(m):
			l = m + 1
		else:
			r = m
	return r
(n, m) = map(int, input().split())

def isEnough(i):
	return (2 * i + 1) ** 2 >= 1 + 8 * (n - m)
if m >= n:
	print(n)
else:
	d = find(1, 2 * (n + m), isEnough)
	print(m + d)


(n, m) = map(int, input().split())
hi = n
lo = m + 1
ans = n
while lo <= hi:
	mid = (hi + lo) // 2
	x = mid - m
	temp = x * (x + 1) // 2
	if n - m - temp <= 0:
		ans = min(ans, mid)
		hi = mid - 1
	else:
		lo = mid + 1
print(ans)


(n, m) = map(int, input().split())
if n <= m:
	print(n)
else:
	w = [1, 10 ** 19]
	for i in range(100):
		x = w[0] + w[1]
		x = x // 2
		y = x + m
		p = x * m + n - m
		q = y * (y + 1) // 2 - m * (m + 1) // 2
		if p >= q:
			w[0] = x
		else:
			w[1] = x
	x = w[0]
	y = x + m
	p = x * m + n - m
	q = y * (y + 1) // 2 - m * (m + 1) // 2
	if p <= q:
		print(m + w[0])
	else:
		print(m + w[1])


def sm(l, r):
	return (r + 1) * r // 2 - (l - 1) * l // 2
(n, m) = map(int, input().split())
if n <= m:
	print(n)
else:
	l = -1
	r = n
	while r - l > 1:
		mid = (l + r) // 2
		if n - sm(1, mid) > m:
			l = mid
		else:
			r = mid
	print(m + r)


def needmore(n, m, k):
	return k * k + k < 2 * (n - m)

def BS(n, m, l, r):
	while l < r:
		mid = (l + r) // 2
		if needmore(n, m, mid):
			l = mid + 1
		else:
			r = mid
	return l
(n, m) = map(int, input().split())
print(m + BS(n, m, 0, 2 * n) if n > m else n)


def s(m):
	x = (1 + m) * m // 2
	return x
import sys
(n, q) = map(int, input().split())
if q >= n:
	print(n)
	sys.exit(0)
(l, r) = (q, n)
while r - l > 1:
	m = (l + r) // 2
	if n - q - s(m - q) <= 0:
		r = m
	else:
		l = m
print(r)


(n, m) = map(int, input().split())
if m >= n:
	print(n)
	exit()
low = int(1)
high = int(10000000000000)
while low < high:
	mid = int(low + int((high - low) / 2))
	if int(mid * (mid + 1)) >= int((n - m) * 2):
		high = mid
	else:
		low = mid + 1
print(int(low + m))


(n, m) = map(int, input().split())
if m >= n or n - m == 1:
	print(n)
else:
	mskip = (m + 1) * m // 2
	l = m + 2
	r = 10 ** 19
	gi = 0
	while l <= r:
		i = (l + r) // 2
		irem = (i + 1) * i // 2 - mskip
		addi = (i - m - 1) * m + n
		if irem >= addi:
			gi = i
			r = i - 1
		else:
			l = i + 1
	print(gi)


from math import sqrt
import decimal
(n, m) = map(int, input().split())
if n >= m:
	ans = (-1 + decimal.Decimal(1 + 8 * (n - m)).sqrt()) / 2
	answer = ans.to_integral_exact(decimal.ROUND_CEILING)
	print(answer + m)
else:
	print(n)


import math
(n, m) = map(int, input().split())
if n <= m:
	print(n)
else:
	r = math.ceil((pow(1 + 8 * (n - m), 0.5) - 1) / 2)
	if n - m > r * (r + 1) // 2:
		print(m + r + 1)
	else:
		print(m + r)


(n, m) = map(int, input().split())
k = 0
l = 0
r = n
for i in range(200):
	k = l + (r - l) // 2
	res = (2 * m + k + 1) * k // 2 - m * (k - 1)
	if res - k < n and res >= n:
		break
	elif res - k >= n:
		r = k
	else:
		l = k
if m + k > n:
	print(n)
else:
	print(m + k)


(n, m) = map(int, input().split())
if m >= n:
	print(n)
else:
	l = 1
	r = 2000000000
	for i in range(100):
		mid = (l + r) // 2
		if mid * (mid + 1) // 2 + m >= n:
			r = mid
		else:
			l = mid
	print(m + r)


(n, m) = map(int, input().split())
l = min(n, m)
r = n
k = min(n, m + 1)
for i in range(200):
	mid = (l + r) // 2
	if n + (mid - k) * m - (2 * k + mid - k) * (mid - k + 1) // 2 <= 0:
		r = mid
	else:
		l = mid
for i in range(l, r + 1):
	if n + (i - k) * m - (2 * k + i - k) * (i - k + 1) // 2 <= 0:
		print(i)
		break


import math as ma
(n, m) = list(map(int, input().split()))
if n >= m:
	st = 0
	end = 10 ** 20
	a = 2 * (n - m)
	e = 0
	while st <= end:
		mid = (st + end) // 2
		b = mid ** 2 + mid
		if b == a:
			e = 1
			break
		elif b > a:
			end = mid - 1
		elif a > b:
			st = mid + 1
	if e == 1:
		print(mid + m)
	else:
		print(st + m)
else:
	print(n)


def segSum(a, b):
	return (a + b) * (b - a + 1) // 2
(n, m) = map(int, input().split())
(l, r) = (m, n)
while r - l > 1:
	days = (l + r) // 2
	cur = n + (days - m - 1) * m - segSum(m + 1, days)
	if cur <= 0:
		r = days
	else:
		l = days
print(r)


def check(mid, n, m):
	k = min(n, m + 1)
	return n + (mid - k) * m - (2 * k + mid - k) * (mid - k + 1) // 2 <= 0
(n, m) = map(int, input().split())
l = min(n, m)
r = n
while r - l > 1:
	mid = (l + r) // 2
	if check(mid, n, m):
		r = mid
	else:
		l = mid
for i in range(l, r + 1):
	if check(i, n, m):
		print(i)
		break


(n, m) = [int(x) for x in input().split()]
if n <= m:
	print(n)
else:
	left = int(0)
	right = int(10000000000.0)
	while left < right:
		x = (left + right) // 2
		res = n + m * x - ((x + m + 1) * (x + m + 2) - m * (m + 1)) // 2
		if res <= 0:
			right = x
		else:
			left = x + 1
	print(left + m + 1)


def main():
	(n, m) = [int(x) for x in input().split()]
	if n <= m:
		print(n)
		return
	import math
	k = (-1.0 + math.sqrt(1.0 + 8.0 * (n - m))) / 2.0
	k = int(k)
	s = 2 * (n - m)
	while s > k * (k + 1):
		k += 1
	print(m + k)
main()


from decimal import Decimal as D
from decimal import getcontext
from math import *
(a, b) = [int(x) for x in input().split(' ')]
if a < b:
	print(a)
else:
	getcontext().prec = 60
	x = D(a)
	y = D(b)
	print(ceil((D('2') * x - D('2') * y + D('0.25')).sqrt() - D('0.5') + y))


def check(mid):
	global n, m
	cnt = n - (mid - m) * (mid - m - 1) // 2
	if mid >= cnt:
		return True
	else:
		return False

def binn():
	global n, m
	l = min(n, m)
	r = n + 1
	while l + 1 < r:
		mid = (l + r) // 2
		if check(mid):
			r = mid
		else:
			l = mid
	print(min(n, r))
(n, m) = map(int, input().split())
binn()


from bisect import *

def ri():
	return map(int, input().split())
(n, m) = ri()
if m - n >= 0:
	print(n)
	exit()
k = n - m
al = 0
ar = 2 * k * (k + 1) + 1
while ar - al > 1:
	a = (al + ar) // 2
	aa = a * (a + 1) // 2
	if k <= aa:
		ar = a
	else:
		al = a
print(ar + m)


(n, m) = map(int, input().split())

def c(n):
	return (1 + n) * n // 2

def md(a, b):
	return (a + b) // 2
if n <= m:
	print(n)
else:
	a = 0
	l = 0
	r = int(1e+18)
	r - l >= 0
	nn = n - m
	while r - l >= 0:
		mid = md(l, r)
		if c(mid) < nn:
			l = mid + 1
		else:
			a = mid
			r = mid - 1
	print(a + m)


import sys
import decimal
from decimal import Decimal
from math import *
decimal.getcontext().prec = 50
(n, m) = (Decimal(x) for x in sys.stdin.readline().split())
if m > n:
	delta = 0
else:
	delta = decimal.Decimal(1 + 8 * n - 8 * m) ** decimal.Decimal(0.5)
d1 = (Decimal(-1) + delta) / Decimal(2)
d2 = (Decimal(-1) - delta) / Decimal(2)
ans = [n]

def test(d):
	d = Decimal(d)
	return (m + d) * (m + d + 1) // 2 - m * (m + 1) // 2 >= n + (d - 1) * m
if ceil(d2) >= 0 and test(ceil(d2)):
	ans.append(m + ceil(d2))
if floor(d2) >= 0 and test(floor(d2)):
	ans.append(m + floor(d2))
if ceil(d1) >= 0 and test(ceil(d1)):
	ans.append(m + ceil(d1))
if floor(d1) >= 0 and test(floor(d1)):
	ans.append(m + floor(d1))
if ceil(d2) + 1 >= 0 and test(ceil(d2) + 1):
	ans.append(m + ceil(d2) + 1)
if floor(d2) + 1 >= 0 and test(floor(d2) + 1):
	ans.append(m + floor(d2) + 1)
if ceil(d1) + 1 >= 0 and test(ceil(d1) + 1):
	ans.append(m + ceil(d1))
if floor(d1) + 1 >= 0 and test(floor(d1) + 1):
	ans.append(m + floor(d1) + 1)
if ceil(d2) - 1 >= 0 and test(ceil(d2) - 1):
	ans.append(m + ceil(d2) - 1)
if floor(d2) - 1 >= 0 and test(floor(d2) - 1):
	ans.append(m + floor(d2) - 1)
if ceil(d1) - 1 >= 0 and test(ceil(d1) - 1):
	ans.append(m + ceil(d1))
if floor(d1) - 1 >= 0 and test(floor(d1) - 1):
	ans.append(m + floor(d1) - 1)
sys.stdout.write('{}\n'.format(min(ans)))


from sys import stdin, stdout
(n, m) = map(int, stdin.readline().rstrip().split())

def triangle(x):
	return x * (x + 1) // 2
if n <= m:
	print(n)
else:
	target = n - m
	minNum = 0
	maxNum = int(10000000000.0)
	finished = False
	while not finished:
		newNum = (minNum + maxNum) // 2
		if triangle(newNum) < target and triangle(newNum + 1) >= target:
			finished = True
		elif triangle(newNum) < target:
			minNum = newNum
		elif triangle(newNum) >= target and triangle(newNum - 1) < target:
			finished = True
			newNum -= 1
		else:
			maxNum = newNum
	print(m + newNum + 1)


(n, m) = map(int, input().strip().split())
lower = m
upper = n
ans = n
while lower <= upper:
	mid = lower + upper >> 1
	j = (mid * (mid + 1) >> 1) - (m * (m + 1) >> 1)
	k = m * (mid - m) + n - m
	if k <= j:
		ans = min(ans, mid)
		upper = mid - 1
	else:
		lower = mid + 1
print(ans)


input = __import__('sys').stdin.readline
(n, m) = map(int, input().split())
if n < m:
	print(n)
	exit()
l = 0
r = 1000000000000000000000000
while l <= r:
	mid = l + (r - l) // 2
	if n - mid * (mid + 1) // 2 >= m + 1 + mid:
		l = mid + 1
	else:
		r = mid - 1
if n - r * (r + 1) // 2 <= m + r + 1:
	print(m + r + 1)
else:
	print(l + m + 1)


def f(i, fd, m, n):
	return i * (i + 1) // 2 - fd * (fd - 1) // 2 >= (i - fd) * m + n

def solve(n, m):
	if m >= n:
		return n
	fd = m
	l = fd
	r = max(n, m) + 100
	while l < r:
		mid = (l + r) // 2
		if f(mid, fd, m, n):
			r = mid
		else:
			l = mid + 1
		if l == r - 1:
			if f(l, fd, m, n):
				r = l
			else:
				l = r
	return l

def brute(n, m):
	i = 1
	cur = n
	while True:
		cur += m
		cur = min(cur, n)
		cur -= i
		if cur <= 0:
			break
		i += 1
	return i
(n, m) = map(int, input().split())
print(solve(n, m))


import sys
(n, m) = map(int, input().split())
if m >= n:
	print(n)
	sys.exit()
ans = m
lo = 1
hi = 10000000000000000000000
temp = 0
while lo <= hi:
	mid = (lo + hi) // 2
	t1 = mid * (mid + 1) // 2
	if t1 >= n - m:
		temp = mid
		hi = mid - 1
	else:
		lo = mid + 1
print(temp + ans)


(n, m) = map(int, input().split())

def s(x):
	return (1 + x) * x

def can(x):
	if x >= n:
		return True
	if x <= m:
		return False
	if 2 * n - s(x - m - 1) <= 2 * x:
		return True
	return False
r = 1000000000000000000
l = 0
while r - l > 1:
	mid = (l + r) // 2
	if can(mid):
		r = mid
	else:
		l = mid
for i in range(l, r + 1):
	if can(i):
		print(i)
		raise SystemExit


import math
(n, m) = map(int, input().split())
if m >= n:
	print(n)
else:
	temp = min(n, m)
	a = temp + 1
	res = temp
	start = 1
	end = int(1e+18)
	while start <= end:
		mid = (start + end) // 2
		if mid * (2 * a + mid - 1) // 2 > n + (mid - 1) * m:
			end = mid - 1
		elif mid * (2 * a + mid - 1) // 2 < n + (mid - 1) * m:
			start = mid + 1
		else:
			start = mid
			break
	print(int(start + res))


import math

def f(j):
	return j * (j + 1)

def binsearch(left, right, t):
	j = (left + right) // 2
	if f(j) >= t and f(j - 1) < t:
		return j
	elif f(j) >= t and f(j - 1) >= t:
		return binsearch(left, j - 1, t)
	else:
		return binsearch(j + 1, right, t)
(n, m) = map(int, input().split())
if m >= n:
	print(n)
else:
	k = n - m
	res = m
	t = 2 * k
	j = 1
	res += binsearch(1, t, t)
	print(res)


def f(x, m):
	return x + max(0, x - m) * max(0, x - m - 1) // 2
(n, m) = map(int, input().split())
l = 0
r = 10000000000000000000
while r - l > 1:
	mid = (l + r) // 2
	N = f(mid, m)
	if N < n:
		l = mid
	else:
		r = mid
if f(l, m) > n:
	print(l)
else:
	print(r)


def isgood(n, m, z):
	n -= m
	m -= z
	if m * (m - 1) // 2 >= n:
		return 1
	return 0
(n, m) = [int(i) for i in input().split()]
l = min(n, m)
r = 1000000000000000000
while l < r:
	mid = (l + r) // 2
	if isgood(n, mid, m):
		r = mid
	else:
		l = mid + 1
print(l)


(n, m) = map(int, input().split())
if n <= m:
	print(n)
	exit(0)
lo = 0
hi = 3000000000
n -= m
while hi - lo > 1:
	mid = (lo + hi) // 2
	sm = mid * (mid + 1) // 2
	if sm <= n:
		lo = mid
	else:
		hi = mid
sm = lo * (lo + 1) // 2
if n - sm <= 0:
	print(m + lo)
else:
	print(m + lo + 1)


def sum(l, r):
	if l == 1:
		return r * (r + 1) // 2
	l -= 1
	left = l * (l + 1) // 2
	return r * (r + 1) // 2 - left

def can(mid, valueonnextday, day, m):
	if mid == 1:
		return valueonnextday - day <= 0
	subtract = sum(day, day + mid - 1)
	addition = (mid - 1) * m
	now = valueonnextday - subtract + addition
	return now <= 0

def give(valueonnextday, day, m):
	s = 1
	e = int(1e+18)
	ans = int(1e+18)
	while s <= e:
		mid = (s + e) // 2
		if can(mid, valueonnextday, day, m):
			ans = min(ans, mid)
			e = mid - 1
		else:
			s = mid + 1
	return ans
(n, m) = list(map(int, input().split()))
daysitcanfull = m + 1
if daysitcanfull >= n:
	print(n)
else:
	valueonnextday = n - daysitcanfull + m
	ans = give(valueonnextday, daysitcanfull + 1, m)
	print(daysitcanfull + ans)


import math
(n, m) = map(int, input().split())
m = min(n, m)
if n == m:
	print(n)
else:
	n -= m
	n += n
	x = math.ceil(n ** 0.5)
	while (x - 1) * x >= n:
		x -= 1
	print(x + m)


import decimal

def mysqrt(n):
	D = decimal.Decimal
	with decimal.localcontext() as ctx:
		ctx.prec = 300
		x = D(n).sqrt()
		x = int(x) - 4
		while True:
			if x >= 0 and x * x >= n:
				return x
			x = x + 1

def solve(n, m):
	rem = n - m
	if rem == 0:
		return m
	rem = mysqrt(8 * rem + 1)
	rem = rem // 2
	return m + rem
(n, m) = input().split()
n = int(n)
m = int(m)
if m > n:
	m = n
ans = solve(n, m)
print(ans)


(n, m) = map(int, input().split())
l = 0
r = 2 ** 64
while r - l > 1:
	M = l + r >> 1
	dell = M * (M + 1) // 2 - m * (m + 1) // 2
	plus = n + max(0, M - m - 1) * m
	if dell >= plus:
		r = M
	else:
		l = M
print(min(r, n))


from math import ceil, sqrt
(n, m) = [int(i) for i in input().split()]
if m >= n:
	print(n)
else:
	l = 0
	r = 10 ** 18
	ans = 10 ** 18
	while l <= r:
		mid = (l + r) // 2
		if mid * mid + mid >= 2 * (n - m):
			ans = mid
			r = mid - 1
		else:
			l = mid + 1
	print(ans + m)


(n, m) = map(int, input().split())
if n <= m:
	print(n)
else:
	am = m
	n -= m
	(l, r) = (0, n + m)
	while l < r:
		m = (l + r) // 2
		val = m * (m + 1) // 2
		if val >= n:
			r = m
		else:
			l = m + 1
	print(l + am)


(n, m) = map(int, input().split())
if n == 1:
	print(1)
elif m >= n - 1:
	print(n)
else:
	r = 1000000000000000000
	frm = m + 1
	l = frm
	while r - l > 1:
		mid = (l + r) // 2
		sum = (mid - frm + 1) * (mid - frm) // 2
		if n - sum - mid <= 0:
			r = mid
		else:
			l = mid
	sum = (l - frm) * (l - frm + 1) // 2
	if n - sum - l <= 0:
		print(l)
	else:
		print(r)


(n, m) = [int(num) for num in input().split()]

def fun(x):
	y = max(0, x - 1 - m)
	z = n - y * (y + 1) // 2
	return z - x <= 0
if m >= n:
	print(n)
else:
	lb = 0
	ub = n
	while ub - lb > 1:
		mid = (ub + lb) // 2
		if fun(mid):
			ub = mid
		else:
			lb = mid
	print(ub)


(n, m) = (int(i) for i in input().strip().split())
if m >= n:
	print(n)
else:
	n -= m
	lo = 0
	hi = 1000000000000000010
	while lo + 1 < hi:
		mi = (lo + hi) // 2
		if mi * (mi + 1) // 2 >= n:
			hi = mi
		else:
			lo = mi
	print(hi + m)


import sys
(n, m) = list(map(int, input().split()))
if n <= m:
	print(n)
	return
else:
	(l, r) = (m + 1, n)
	base = m * (m - 1) // 2
	while l != r:
		mid = (l + r) // 2
		plus = n + base + (mid - m) * m
		minus = mid * (mid + 1) // 2
		if plus > minus:
			l = mid + 1
		else:
			r = mid
	print(l)


def binary_search(n, nm):
	lo = 0
	hi = n
	while lo < hi:
		mid = (lo + hi) // 2
		midval = mid ** 2 + 3 * mid + 2
		if midval < nm:
			lo = mid + 1
		elif midval > nm:
			hi = mid
		else:
			return mid
	return lo
[n, m] = map(int, input().split())
if n - m <= 0:
	print(n)
else:
	print(m + binary_search(n, 2 * (n - m)) + 1)


import sys
import os

def BS(l, h, k):
	if h < l:
		return l
	mid = (l + h) // 2
	if mid * (mid + 1) >= 2 * k:
		return BS(l, mid - 1, k)
	else:
		return BS(mid + 1, h, k)
(n, m) = map(int, input().split())
if m >= n:
	print(n)
else:
	x = n - m
	idx = BS(0, 1000000000000000000, x)
	print(idx + m)


import math
from decimal import Decimal
Decimal(410241186411534352).sqrt()
a = input().split()
size = int(a[0])
stock = size
apport = int(a[1])
day = apport
if stock <= apport:
	print(stock)
else:
	d = (-1 + Decimal(1 - 4 * (1 + 2 * apport - 2 * stock)).sqrt()) / 2
	print(day + math.ceil(d))


import sys
cases = False

def c2(n):
	return n * (n + 1) // 2

def get():
	return list(map(int, input().split()))

def bits(n: int):
	return list(bin(n)).count('1')

def main(test_case=False):
	n = int(input()) if test_case else 1
	for _ in range(n):
		test()

def flush():
	sys.stdout.flush()

def parr(arr):
	print(*arr, sep=' ')

def gcd(a, b):
	while b:
		if b % a == 0:
			break
		tmp = a
		a = b % a
		b = tmp
	return a

def check(n, m, k):
	t = k - m - 1
	if t < 0:
		return False
	return n <= k + t * (t + 1) // 2

def test():
	(n, m) = get()
	left = 1
	right = n
	ans = right
	while left <= right:
		mid = (left + right) // 2
		if check(n, m, mid):
			ans = min(ans, mid)
			right = mid - 1
		else:
			left = mid + 1
	print(ans)
main(cases)


def main():
	(n, m) = list(map(int, input().split()))
	if m >= n:
		print(n)
		return

	def ok(x):
		return x * (x + 1) // 2 + x * m >= n + m * max(0, x - 1)
	ll = 0
	rr = int(10 ** 19)
	for i in range(100):
		mm = (ll + rr) // 2
		if not ok(mm):
			ll = mm
		else:
			rr = mm
	while rr > 0 and ok(rr - 1):
		rr -= 1
	while not ok(rr):
		rr += 1
	print(m + rr)
main()


def sum(x):
	return x * (x + 1) // 2
(n, m) = input().split()
n = int(n)
m = int(m)
if m + 1 >= n:
	print(n)
else:
	n -= m + 1
	l = m + 2
	r = 10 ** 18
	ans = r
	while l <= r:
		mid = (l + r) // 2
		if -(mid - (m + 1)) * m + sum(mid) - sum(m + 1) >= n:
			if mid < ans:
				ans = mid
			r = mid - 1
		else:
			l = mid + 1
	print(ans)


(n, m) = map(int, input().split())
l = 1
r = n
mid = 1
while l < r:
	mid = (l + r) // 2
	if n - (mid - m - 1) * (mid - m) // 2 <= mid and mid - m >= 0 or mid >= n:
		r = mid
	else:
		l = mid + 1
print(l)


(n, m) = map(int, input().split())
k = min(n, m)
n -= min(n, m)
l = 0
r = 123123123123123000
while l < r:
	m = (l + r) // 2
	if int((1 + m) * m // 2) >= n:
		r = m
	else:
		l = m + 1
print(l + k)


def main():
	(n, m) = map(int, input().split())
	if m >= n:
		print(n)
	else:
		l = 0
		r = 10 ** 18
		ans = -1
		while l <= r:
			mid = (r - l) // 2 + l
			k = n + m * (m - 1) // 2 + m * mid - (m + mid) * (m + mid + 1) // 2
			if k <= 0:
				r = mid - 1
				ans = mid
			else:
				l = mid + 1
		print(m + ans)
	return
main()


(n, m) = map(int, input().split())
(l, r) = (0, n)
mid = 0
for i in range(10 ** 5):
	mid = (l + r) // 2
	if n - mid * (mid + 1) // 2 - m <= 0:
		r = mid
	else:
		l = mid + 1
if n - l * (l + 1) // 2 - m <= 0:
	print(min(m, n) + l)
elif n - mid * (mid + 1) // 2 - m <= 0:
	print(mid + min(n, m))
else:
	print(r + min(n, m))


from random import randint

def tl(n, m):
	nn = n
	for i in range(1, n + 1):
		n -= i
		if n <= 0:
			return i
		n = min(nn, n + m)

def solve(n, m):
	if n <= m:
		return n
	else:
		ans = m
		d = m + 1
		cur = n - m
		cur *= 2
		i = int(cur ** 0.5)
		STEP = 10 ** 6
		for j in range(max(0, i - STEP), i + STEP):
			if j * (j + 1) >= cur:
				return min(n, ans + j)
		return ans
(n, m) = map(int, input().split())
print(solve(n, m))


def check(x):
	y = min(x - 1, m)
	return x * (x + 1) // 2 >= n + y * (y + 1) // 2 + max(0, x - m - 1) * m

def main():
	if n <= m:
		print(n)
		return 0
	(l, r, ans) = (1, 10 ** 18, 0)
	while l <= r:
		mid = (l + r) // 2
		if check(mid):
			ans = mid
			r = mid - 1
		else:
			l = mid + 1
	print(ans)
	return 0
(n, m) = [int(i) for i in input().split()]
main()


from math import *
(n, m) = [int(j) for j in input().split()]
if n <= m:
	print(n)
else:
	k = ceil((-1 + sqrt(1 + 8 * (n - m))) / 2)
	while k * (k + 1) >= 2 * (n - m):
		k -= 1
	k += 1
	print(m + k)


def work(days, n, m):
	k = days - (m + 1)
	loss = (1 + k) * k // 2
	return n - loss - days <= 0

def main():
	(n, m) = [int(x) for x in input().split()]
	if m >= n:
		print(n)
		return
	left = m + 1
	right = n
	while left < right:
		mid = (left + right) // 2
		if work(mid, n, m):
			right = mid
		else:
			left = mid + 1
	print(left)
main()


(n, m) = map(int, input().split())
(l, r) = (0, 10 ** 10)

def calc(t):
	return n - m - t * (t + 1) // 2 > 0
if n <= m:
	print(n)
else:
	while r - l > 1:
		tmp = (l + r) // 2
		if calc(tmp):
			l = tmp
		else:
			r = tmp
	print(m + r)


from math import ceil
import decimal

def f(n, m):
	if m >= n:
		return n
	return m + ceil((-1 + (1 + 8 * decimal.Decimal(n - m)).sqrt()) / 2)
(n, m) = list(map(int, input().split()))
print(f(n, m))


def check(n, m, k):
	if k * (k + 1) // 2 + k >= n - m - 1:
		return True
	else:
		return False

def solve(n, m):
	start = 0
	end = n
	res = 0
	if n <= m:
		return n
	while start <= end:
		mid = start + (end - start) // 2
		if check(n, m, mid):
			end = mid - 1
			res = mid + m + 1
		else:
			start = mid + 1
	return res
(n, m) = map(int, input().strip().split())
res = solve(n, m)
print(res)


(n, m) = map(int, input().split())
lo = m
hi = n
while lo < hi:
	a = lo + (hi - lo) // 2
	p = a - 1
	k = n - (p - m + 1) * (m + p) // 2 + (p - m + 1) * m
	if k - a <= 0:
		hi = a
	else:
		lo = a + 1
print(min(lo, n))


s = input().split(' ')
n = int(s[0])
m = int(s[1])
if m >= n:
	print(n)
else:
	x = (8 * n - 8 * m + 1) ** 0.5 / 2 - 0.5
	y = int(x)
	if y ** 2 + y >= 2 * n - 2 * m:
		print(m + y)
	else:
		print(m + y + 1)


(n, m) = map(int, input().split())

def bs(f, l):
	mid = (f + l) // 2
	t = mid - m
	if f == l - 1:
		return l
	if n - m - t * (t + 1) // 2 > 0:
		return bs(mid, l)
	return bs(f, mid)
if m < n:
	print(bs(m - 1, n + 1))
else:
	print(n)


import math
(n, k) = [int(x) for x in input().strip().split()]
st = k + 1

def judge(ed):
	global st, n, k
	if ed <= k:
		return True
	grow = n - k + (ed - st + 1) * k
	eat = (st + ed) * ((ed - st + 1) // 2)
	if (ed - st) % 2 == 0:
		eat += (ed + st) // 2
	return grow > eat

def bs(begin, end):
	if begin == end:
		return begin
	mid = (begin + end) // 2
	if judge(mid):
		return bs(mid + 1, end)
	else:
		return bs(begin, mid)
if k >= n:
	print(n)
else:
	print(bs(1, n + 1))


a = [int(i) for i in input('').split()]
n = a[0]
m = a[1]
if m >= n:
	ans = n
	print(ans)
	exit()
k = (-1.0 - (1 + 4 * (2 * n - 2 * m)) ** 0.5) / -2
k = int(k + m)
beg = max(k - 3000, m + 1)
end = min(n + 1, k + 3000)
ans = k + 3000
for d in range(beg, end, 1):
	k = d - m
	food = n + m * (k - 1)
	eat = (m + 1 + m + k) * k // 2
	if food <= eat:
		if ans > d:
			ans = d
print(ans)


def main():
	(n, m) = list(map(int, input().split()))
	(l, r) = (1, n)
	while l < r:
		mid = l + (r - l) // 2
		height = max(mid - 1 - m, 0)
		take = mid + (1 + height) * height // 2
		if take >= n:
			r = mid
		else:
			l = mid + 1
	print(l)
main()


import sys
import time
import re
import pprint
import random

def dbg(x, y=None):
	if y is None:
		dbgout = pprint.pformat(x)
	else:
		dbgout = x + ' = ' + pprint.pformat(y)
	sys.stderr.write('>>> ' + dbgout + '\n')
	sys.stderr.flush()
oo = 4557430888798830399
n = 0
m = 0
magic = 0

def ok(x):
	global n
	global m
	global magic
	tmp = n
	tmp -= x * (x + 1) // 2
	tmp -= magic
	tmp -= x
	return tmp <= 0

def find(l, r):
	if r < l:
		return -1
	m = (l + r) // 2
	if ok(m) == False:
		return find(m + 1, r)
	tmp = find(l, m - 1)
	if tmp < 0:
		return m
	return tmp

def main():
	global n
	global m
	global magic
	(n, m) = input().split()
	n = int(n)
	m = int(m)
	magic = m + 1
	ans = magic + find(0, 1000000000000000000)
	if n <= m:
		ans = n
	print(ans)
main()


(n, m) = list(map(int, input().split()))
if n <= m:
	print(n)
else:
	x = int((-1 + (1 + 8 * (n - m)) ** 0.5) / 2)
	if x * (x + 1) // 2 >= n - m:
		ans = m + x
	else:
		ans = m + x + 1
	print(ans)


def f(a, b, m):
	tm = a + b * m
	to = (m + b) * (m + b + 1) // 2
	to -= m * (m + 1) // 2
	return tm - to
(n, m) = [int(x) for x in input().split()]
if m >= n:
	print(n)
else:
	l = 0
	h = 2 * n
	nn = n - m
	while h - l > 1:
		mid = (h + l) // 2
		if f(nn, mid, m) >= 0:
			l = mid
		else:
			h = mid
	add = 0
	if f(nn, l, m) > 0:
		add = 1
	print(m + l + add)


from __future__ import print_function
from sys import stdin
from heapq import *
from math import log2, ceil, sqrt, gcd, log
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
rr = lambda x: reversed(range(x))
mod = int(1000000000.0) + 7
inf = float('inf')
(n, m) = gil()
if n <= m:
	print(n)
	exit()
(l, r) = (1, int(1e+18))
ans = -1
n -= m
while l <= r:
	mid = (l + r) // 2
	if n <= mid * (mid + 1) // 2:
		ans = mid
		r = mid - 1
	else:
		l = mid + 1
print(ans + m)


import sys
(n, m) = map(int, input().split())
l = m + 1
r = 10 ** 30
ans = n
if n == 1:
	ans = 1
elif m < n:
	while l != r:
		mid = (l + r) // 2
		if 2 * m + (mid - m) * (mid - m + 1) < 2 * n:
			l = mid + 1
		else:
			r = mid
	ans = min(ans, l)
else:
	ans = n
print(int(ans))


def f(n, m):
	sz = n
	n -= 1
	step = 2
	print('n = ', n)
	while n > 0:
		n += m
		n = min(n, sz)
		n -= step
		step += 1
		print('n = ', n)
	return step - 1
(n, m) = map(int, input().split())
m = min(n, m)
cnt = max(n - m, 0)
l = 0
r = 10 ** 18
while l + 1 < r:
	m1 = (l + r) // 2
	x = m1 * (m1 - 1) // 2
	if x < cnt:
		l = m1
	else:
		r = m1
print(m - 1 + r)


import sys

def check(val, n, m):
	x = val * (val - 1) // 2
	return n - m - x > 0

def out(x):
	print(x)

def main():
	if len(sys.argv) > 1 and sys.argv[1] == 'debug':
		sys.stdin = open('xxx.in', 'r')
		sys.stdout = open('xxx.out', 'w')
	(n, m) = map(int, input().split())
	if n <= m:
		out(n)
		return
	l = 0
	r = 10 ** 20
	while r - l > 1:
		mid = (l + r) // 2
		if check(mid, n, m):
			l = mid
		else:
			r = mid
	print(m + l)
main()


from decimal import *
from decimal import Decimal as D
getcontext().prec = 80
(n, m) = [D(x) for x in input().split()]
m = min(m, n)
if n == 1:
	print('1')
if n > 1:
	k = min(n, m - 1)
	ssq = (4 * k ** 2 + k * (4 - 8 * m) + 4 * m ** 2 - 12 * m + 8 * n + 1) ** D('0.5')
	l1 = (ssq + 2 * m - 1) / 2
	day1 = int(l1) if l1 - int(l1) == 0 else int(l1) + 1
	print(day1)


def good(mid, n, m):
	fans = n - (mid * (mid + 1) // 2 - m * (m + 1) // 2) + (mid - m - 1) * m
	if fans <= 0:
		return True
	else:
		return False
(n, m) = map(int, input().split())
l = m
r = 10 ** 19
ans = -1
if n <= m:
	print(n)
	exit()
while l <= r:
	mid = (l + r) // 2
	if good(mid, n, m) == True:
		ans = mid
		r = mid - 1
	else:
		l = mid + 1
print(ans)


import decimal
decimal.getcontext().rounding = decimal.ROUND_CEILING

def ceil2(n):
	return int(n.quantize(1))

def f(n, m):
	if m >= n:
		return n
	n -= m
	N = decimal.Decimal(n)
	d1 = ceil2((-1 + (1 + 8 * N).sqrt()) / 2)
	d2 = ceil2((-1 - (1 + 8 * N).sqrt()) / 2)
	d = d2 if d2 > 0 else d1
	return d + m
(n, m) = list(map(int, input().split()))
print(f(n, m))


import math
a = input().split()
n = int(a[0])
m = int(a[1])
if n <= m:
	print(n)
else:
	delta = 1 + 8 * n - 8 * m
	tmp = m - 0.5 + 0.5 * math.sqrt(delta)
	ans = math.ceil(tmp)
	if ans < m:
		ans = m
	while (ans - m) * (ans - m + 1) < 2 * (n - m):
		ans += 1
	while (ans - m) * (ans - m - 1) >= 2 * (n - m):
		ans -= 1
	print(ans)


(n, m) = map(int, input().split())
if n <= m:
	print(n)
else:
	M = m
	n = n - m
	(l, r) = (0, 100000000000000000000)
	while l < r:
		m = (l + r) // 2
		val = (m * m + m) // 2
		if val >= n:
			r = m
		else:
			l = m + 1
	print(l + M)


import sys
(m, n) = map(int, input().split())
if m <= n:
	print(m)
	sys.exit(0)
daypassed = n
remain = m - n
l = 0
r = int(2000000000.0)

def f(m):
	return m * (m + 1) // 2
while r > l:
	m = (l + r) // 2
	if f(m) >= remain:
		r = m
	else:
		l = m + 1
print(daypassed + l)


def check(t):
	return m + t >= n - (t - 1) * t // 2
(n, m) = map(int, input().split())
if m >= n:
	print(n)
else:
	l = 0
	r = 10 ** 30
	while l < r - 1:
		mid = (l + r) // 2
		if check(mid):
			r = mid
		else:
			l = mid
	print(m + r)


import math
(n, m) = map(int, input().split())
if n <= m:
	print(n)
else:
	n = n - m
	(l, r) = (0, int(2000000000.0))
	while l < r:
		mid = (l + r) // 2
		value = mid * (mid + 1) // 2
		if value >= n:
			r = mid
		else:
			l = mid + 1
	print(m + l)


import sys
import math
from decimal import Decimal
line = input()
line = line.split()
n = line[0]
m = line[1]
n = Decimal(n)
m = Decimal(m)
if m >= n:
	print(n)
	sys.exit()

def f(x):
	return math.floor(x * (x + 1) / 2) + x

def search(tar, bot, top):
	bot = Decimal(bot)
	top = Decimal(top)
	curr = math.floor((bot + top) / 2)
	curr = Decimal(curr)
	if f(curr) >= tar and f(curr - 1) < tar:
		return curr + 1
	elif f(curr) < tar:
		return search(tar, curr, top)
	elif f(curr) >= tar:
		return search(tar, bot, curr)
ans = search(n - m - 1, 0, 2000000000) + m
print(ans)


(cap, load) = map(int, input().split())
from math import sqrt

def check(c, l, i):
	if i <= l:
		return c
	tt = i - l
	return c - i * (i + 1) // 2 + l * (l + 1) // 2 + tt * l
if cap <= load:
	print(cap)
else:
	low = 1
	high = int(1e+18 + 1)
	mid = low + (high - low) // 2
	while low < high:
		if check(cap, load, mid) > load:
			low = mid + 1
		else:
			high = mid
		mid = low + (high - low) // 2
	print(mid)


(n, m) = map(int, input().split())
if n <= m:
	print(n)
	quit()
left = 0
right = 2 * 10 ** 9
while right - left > 1:
	mid = (right + left) // 2
	q = n - mid * (mid + 1) // 2
	if q > m:
		left = mid
	else:
		right = mid
ans = m + right
print(ans)


(n, m) = map(int, input().split())
if n <= m:
	print(n)
else:
	init = m
	n = n - m
	lo = 1
	hi = int(1e+19)
	poss = 0
	while hi >= lo:
		mid = (hi + lo) // 2
		consumed = mid * (mid + 1) // 2
		if consumed >= n:
			poss = mid
			hi = mid - 1
		else:
			lo = mid + 1
	print(poss + init)


(n, m) = map(int, input().split())

def valid(k, n):
	cont_sum = k * (k + 1) // 2
	return n <= cont_sum
if n > m:
	MAX = 2000000000
	(left, right) = (1, MAX)
	desire = n - m
	while left < right:
		mid = (left + right) // 2
		if valid(mid, desire):
			right = mid
		else:
			left = mid + 1
	print(left + m)
else:
	print(n)


(n, m) = map(int, input().split())
if m >= n - 1:
	print(n)
	exit()
(a, b) = (0, n)
while a < b - 1:
	c = (a + b) // 2
	if c > m and (c - m) * (c - m + 1) // 2 >= n - m:
		b = c
	else:
		a = c
print(b)


(n, m) = map(int, input().split())
if m >= n:
	from sys import exit
	print(n)
	exit()
(i, j) = (m, n)
result = m
item = m * (m + 1) // 2
while i + 1 < j:
	mid = (i + j) // 2
	if mid * (mid + 1) // 2 - item >= n + m * (mid - m - 1):
		j = mid
	else:
		i = mid
if i * (i + 1) // 2 - item >= n + m * (i - m - 1):
	print(i)
else:
	print(j)


(n, m) = map(int, input().split())

def fef(vev):
	from math import sqrt
	val = int(sqrt(2 * vev))
	if val * (val + 1) >= 2 * vev:
		return val
	return val + 1
if m >= n:
	print(n)
else:
	delta = n - m
	day = m
	day += fef(delta)
	print(day)


def binp(l, r, n, d):
	m = (l + r) // 2
	while abs(l - r) > 1:
		m = (l + r) // 2
		if m * m + m - 2 * (n - d) == 0:
			return m
		if m * m + m - 2 * (n - d) > 0:
			r = m
		else:
			l = m
	if l * l + l - 2 * (n - d) < 0:
		return r
	else:
		return l
a = input().split()
for i in range(len(a)):
	a[i] = int(a[i])
if a[0] != 1:
	if a[0] > a[1]:
		ans = binp(1, a[0], a[0], a[1])
		print(ans + a[1])
	else:
		print(a[0])
else:
	print(1)


(n, m) = list(map(int, input().split()))
if n <= m:
	print(n)
else:
	n -= m
	l = 0
	r = n
	while l + 1 < r:
		h = (l + r) // 2
		if h * (h + 1) < 2 * n:
			l = h + 1
		else:
			r = h
	if l * (l + 1) >= 2 * n:
		print(l + m)
	else:
		print(r + m)


from sys import stdin, stdout
from math import sqrt
(n, k) = map(int, stdin.readline().split())
k = min(k, n)

def sqrtt(x):
	l = 1
	r = x
	while r - l > 10 ** (-3):
		m = (r + l) / 2
		if m * m >= x:
			r = m
		else:
			l = m
	if int(r) * int(r) >= x:
		return int(r)
	else:
		return r
D = 9 + 8 * (n - k - 1)
day1 = (sqrtt(D) - 3) / 2
if day1 - int(day1) == 0:
	stdout.write(str(int(day1) + 1 + k))
else:
	stdout.write(str(int(day1) + 2 + k))


(n, m) = input().split()
n = int(n)
m = int(m)
if n <= m:
	print(n)
else:
	k = m
	lo = 0
	hi = m + n
	y = m * (m + 1) // 2
	bs = m + n
	while lo <= hi:
		md = (lo + hi) // 2
		x = m + md
		z = x * (x + 1) // 2
		z -= y
		z = n - m + md * m - z
		if z <= 0:
			bs = md
			hi = md - 1
		else:
			lo = md + 1
	print(k + bs)


import math
import itertools

def ria():
	return [int(i) for i in input().split()]

def sum_range(start, end):
	return int(end * (end + 1) // 2 - (start - 1) * start // 2)
(n, m) = ria()

def f(k):
	global n, m
	return n - sum_range(m + 1, m + k) + m * (k - 1) <= 0
if n <= m:
	print(n)
	exit(0)
(l, r) = (1, n + m)
while l < r:
	m1 = (l + r) // 2
	if not f(m1):
		l = m1 + 1
	elif f(m1 - 1):
		r = m1 - 1
	else:
		(l, r) = (m1, m1)
		break
res = r
if f(l):
	res = l
print(res + m)
suma = m


def mySqrt(n):
	l = 0
	r = n + 1
	while l < r - 1:
		m = (l + r) // 2
		if m * m > n:
			r = m
		else:
			l = m
	return l
(n, m) = [int(i) for i in input().split()]
if m >= n:
	print(n)
else:
	ans = m
	d = (-1 + mySqrt(1 + 8 * (n - m))) // 2
	while d * (d - 1) // 2 + d + m >= n:
		d -= 1
	while d * (d - 1) // 2 + d + m < n:
		d += 1
	print(m + d)


def fun(i, n, m):
	return i * i + i - 2 * n + 2 * m
(n, m) = map(int, input().split())
if m >= n:
	print(n)
	exit(0)
(left, right) = (1, 10 ** 18)
while left < right:
	mid = (left + right) // 2
	if fun(mid, n, m) < 0:
		left = mid + 1
	else:
		right = mid
print(left + m)


(n, m) = map(int, input().split())
if n <= m:
	print(n)
else:
	low = 1
	high = 2000000000000000000
	while low <= high:
		if low == high:
			print(low)
			break
		mid = (low + high) // 2
		val = 0
		if mid - m - 1 > 0:
			val = val + (mid - m - 1) * (mid - m) // 2
		val = val + mid
		if val >= n:
			high = mid
		else:
			low = mid + 1