https://acm.ecnu.edu.cn/contest/405/problem/A/
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
typedef long long ll;
ll f(ll k) {
ll half=sqrt(2*k);
// ll tmp1=(half-1)*half/2;
ll tmp2=(half+1)*half/2;
// ll tmp3=(half+1)*(half+2)/2;
// printf("1 = %lld, 2 = %lld, 3 = %lld\n",tmp1,tmp2,tmp3);
ll star;
if(tmp2>k) star=half;
else star=half+1;
// printf("star = %lld\n",star);
return star;
}
int main() {
// for(int i=1; i<=40; i++) {
// for(int j=1; j<=40; j++) printf("%-4d",i+j);
// puts("");
// }
ll m,k;
while(~scanf("%lld%lld",&m,&k)) {
ll star=f(k);
if(star<=m) {
printf("%lld\n",star+1);
} else {
ll a=m*m-k;
ll star2=f(a);
printf("%lld\n",2*m+1-star2);
}
}
return 0;
}