#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using edge = struct { int to, cost; };
const int MOD = 1e9 + 7;
const int iINF = 1e9;
const long long int llINF = 1e18;
const double PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
int main() {
  ll N, X;
  cin >> N >> X;
  vector<ll> memo(N);
  ll ans = 0;
  for (int i = 0; i < N; i++) {
    if (i == 0) {
      memo[i] = X;
    } else if (i % 2 == 0) {
      memo[i] = i * X;
      if (N < memo[i]) break;
    } else if (i % 2 == 1) {
      memo[i] = i * (N - memo[i - 1]);
    }
    ans += memo[i];
  }
  cout << ans << endl;
  return 0;
}
