#include<bits/stdc++.h>
#define FOR(i,a,b) for(long long int i=(a);i<=(b);++i)
#define NFOR(i,a,b) for(long long int i=(a);i>=(b);--i)
#define pb push_back
#define ll long long
#define F first
#define S second
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
#define MOD 1000000007
using namespace std;
//ll prime[10000007];
//vector<ll>stprime;
//ll fastpow(ll base, ll exp) {ll res=1;while(exp>0) {if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return res%MOD;}
//void sieve(){memset(prime,1,sizeof(prime));prime[0]=0;prime[1]=0;for(ll i=2;i*i<=10000000;++i){if(prime[i]){for(ll j=i*i;j<=10000000;j+=i)prime[j]=0;}}FOR(i,1,1000000){if(prime[i])stprime.pb(i);}}
//bool comp(const ll &a,const ll &b){if(a>b)return true;else return false;}
//**********************************************************************************************************************************************//
int main()
{
fast;
ll t,n,h,q,x,y,w,m;
cin>>n>>m;
ll temp=m;
if(m>=n)
{cout<<n<<endl;return 0;}
m=n-m;
ll him=pow(1+8*m,0.5);
if(him*him!=1+8*m)
him++;
him-=1;
ll temp1=him;
him/=2;
if(temp1%2!=0)him++;
//cout<<him<<endl;
ll ans=temp+him;
cout<<ans<<endl;
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KI2RlZmluZSBGT1IoaSxhLGIpIGZvcihsb25nIGxvbmcgaW50IGk9KGEpO2k8PShiKTsrK2kpCiNkZWZpbmUgTkZPUihpLGEsYikgZm9yKGxvbmcgbG9uZyBpbnQgaT0oYSk7aT49KGIpOy0taSkKI2RlZmluZSBwYiBwdXNoX2JhY2sKI2RlZmluZSBsbCBsb25nIGxvbmcKI2RlZmluZSBGIGZpcnN0CiNkZWZpbmUgUyBzZWNvbmQKI2RlZmluZSBmYXN0IGlvc19iYXNlOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpOyBjaW4udGllKE5VTEwpCiNkZWZpbmUgTU9EIDEwMDAwMDAwMDcKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKLy9sbCBwcmltZVsxMDAwMDAwN107Ci8vdmVjdG9yPGxsPnN0cHJpbWU7Ci8vbGwgZmFzdHBvdyhsbCBiYXNlLCBsbCBleHApIHtsbCByZXM9MTt3aGlsZShleHA+MCkge2lmKGV4cCUyPT0xKSByZXM9KHJlcypiYXNlKSVNT0Q7YmFzZT0oYmFzZSpiYXNlKSVNT0Q7ZXhwLz0yO31yZXR1cm4gcmVzJU1PRDt9Ci8vdm9pZCBzaWV2ZSgpe21lbXNldChwcmltZSwxLHNpemVvZihwcmltZSkpO3ByaW1lWzBdPTA7cHJpbWVbMV09MDtmb3IobGwgaT0yO2kqaTw9MTAwMDAwMDA7KytpKXtpZihwcmltZVtpXSl7Zm9yKGxsIGo9aSppO2o8PTEwMDAwMDAwO2orPWkpcHJpbWVbal09MDt9fUZPUihpLDEsMTAwMDAwMCl7aWYocHJpbWVbaV0pc3RwcmltZS5wYihpKTt9fQovL2Jvb2wgY29tcChjb25zdCBsbCAmYSxjb25zdCBsbCAmYil7aWYoYT5iKXJldHVybiB0cnVlO2Vsc2UgcmV0dXJuIGZhbHNlO30KLy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLy8KaW50IG1haW4oKQp7CgogICAgZmFzdDsKICAgIGxsIHQsbixoLHEseCx5LHcsbTsKICAgICBjaW4+Pm4+Pm07CiAgICAgbGwgdGVtcD1tOwogICAgaWYobT49bikKICAgICAgICB7Y291dDw8bjw8ZW5kbDtyZXR1cm4gMDt9CiAgICBtPW4tbTsKICAgIGxsIGhpbT1wb3coMSs4Km0sMC41KTsKICAgIGlmKGhpbSpoaW0hPTErOCptKQogICAgICBoaW0rKzsKICAgIGhpbS09MTsKICAgIGxsIHRlbXAxPWhpbTsKICAgIGhpbS89MjsKICAgIGlmKHRlbXAxJTIhPTApaGltKys7CiAgICAvL2NvdXQ8PGhpbTw8ZW5kbDsKICAgIGxsIGFucz10ZW1wK2hpbTsKICAgIGNvdXQ8PGFuczw8ZW5kbDsKCgoKCgoKCgoKcmV0dXJuIDA7Cn0=