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: interview

Starter code:

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

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)

n,m = list(map(int,input().split()))
if m >= n:
    print(n)
else:
    ans = m
    pos = -1
    low = 0
    high = 10**12
    n -= m
    while low <= high:
        mid  = (low+high)//2
        # print(mid,(mid*(mid+1))//2)
        if (mid*(mid+1))//2 >= n:
            pos = mid
            high = mid-1
        else:
            low = mid+1
    print(ans+pos)


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

if n <= m:
    print(n)
else:
    ok = 10 ** 100
    ng = 0
    while ok - ng > 1:
        mid = (ok + ng) // 2
        s = n - mid * (mid - 1) // 2 - (m + mid)

        if s <= 0:
            ok = mid
        else:
            ng = mid

    print(ok + m)

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


def check(i):
    se = ((m + i) * (i - m + 1)) // 2
    pr = m * (i -  m + 1)
    if (n >= (se - pr)):
        return True
    else:
        return False
if m >= n:
    print(n)
    return
m += 1
left = m
right = int(5e18) + 10
n -= m
while (right - left > 1):
    mid = (left + right) // 2
    if (check(mid)):
        left = mid
    else:
        right = mid
print(left)


import sys
n,m=input().split()
n=int(n);m=int(m)
ans=m
if m>=n:
	print(n)
	return
high=10**20;low=1
dif=n-m
#print("dif",dif)
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
#print('mid',mid)
ans+=mid
print(ans)

N, M = list(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)


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)


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)



# -*- coding: utf-8 -*-
"""
Created on Wed Mar 15 23:00:22 2017

@author: Anan
"""

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

if n<=m :
    print(n)
else :
    
    ans = m
    L =0
    R = 123456789123456789123
    while R-L != 1 :
        mid = (L+R)//2
        if n-mid*(mid-1)//2 <= m+mid :
            R=mid
        else :
            L=mid
    print(ans + R)

n,m=[int(i) for i in input().split()]
if m>=n:
    print(n)
else:
    l,r=-1,10**18
    now=n-m
    while r-l>1:
        md=(l+r)//2
        if now+md*m-(m*2+md+1)*md//2<=0:
            r=md
        else:
            l=md
    print(r+m)

n, m = map(int, input().split())
if n <= m:
    print(n)
else:
    init = m
    n = n - m
    lo = 1
    hi = int(1e19)
    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, s = list(map(int,input().split(' ')))
if n <= s:
    ans = n
else:
    ans = s
    l = 0
    r = 10 ** 10
    n -= s
    while l + 1 < r:
        m = (l + r) // 2
        if m * (m+1) // 2 < n:
            l = m
        else:
            r = m
    ans += r
print(ans)


n, m = map(int, input().split())
l = 0
r = 10 ** 18 + 1
d = n - m
while r - l > 1:
    mi = (r + l) // 2
    if d > mi *(mi + 1) // 2:
        l = mi
    else:
        r = mi
if n > m:
    print(r + m)
else:
    print(n)

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

res = m + 1
n -= m
left, right = 0, int(1e19)

while right - left > 1:
    middle = (left + right) // 2
    if middle * (middle + 1) // 2 < n:
        left = middle
    else:
        right = middle

print(res + left)

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 = list(map(int, input().split()))
l = -1
r = int(1e18 + 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)

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)


import sys
n, m = list(map(int, input().split()))
m = min(n - 1, m)
fday = -1
lday = n
while (fday + 1 < lday):
    mid = (fday + lday) // 2
    S = n - (mid * (mid + 1)) // 2 - m
    if (S <= 0):
        lday = mid
    else:
        fday = mid
print(min(n, m + lday))


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) 

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().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))

"""Codeforces Round #404 (Div. 2)

C. Anton and Fairy Tale
"""


def main():
    n, m = list(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)


def __starting_point():
    main()

__starting_point()


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)


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
    #print("mid = " + str(mid))
    #print("f = " + str(f(mid,fd,m,n)))
    if f(mid, fd, m, n):
      r = mid
    else:
      l = mid + 1
     # print("now l = " + str(l) + " r = " + str(r) + " " + str((l == r - 1)))
    
    if l == r - 1:
      #print("last l = " + str(l) + " fl = " + str(f(l, fd,m,n)))
      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))