#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = a; i <= (b); i++)
#define drep(i, a, b) for (int i = a; i >= (b); i--)
typedef long long ll;
int n, c;
ll ccc(int x) {
return (1ll * x * x - x % 2) / 4;
}
ll cal(int num) {
int a = n / num, b = a + 1, cb = n % num, ca = num - cb;
ll tot;
if (num == 1)
tot = 0;
else {
tot = n - 1;
if (cb >= 2) {
tot -= 2 * (b / 2);
} else if (cb == 1) {
tot -= b / 2 + a / 2;
} else
tot -= 2 * (a / 2);
}
return tot + 1ll * num * c + ccc(a) * ca + ccc(b) * cb;
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> c;
int l = 1, r = n;
ll ans = 1e18;
for (int i = 1; i <= 1000000; ++i) {
int lm = l + (r - l) / 3, rm = r - (r - l) / 3;
ans = min({ans, cal(lm), cal(rm)});
if (cal(lm) < cal(rm))
r = rm;
else
l = lm;
}
ll ans = 1e18;
ans = min(ans, cal(l));
cout << ans;
return 0;
}