#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// --------------------------------------------------------
template <class T>
bool chmax(T& a, const T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
#define FOR(i, l, r) for (int i = (l); i < (r); ++i)
#define RFOR(i, l, r) for (int i = (r)-1; (l) <= i; --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define MIN(c) *min_element(ALL(c))
#define MAX(c) *max_element(ALL(c))
#define SUM(c) accumulate(ALL(c), 0)
#define SUMLL(c) accumulate(ALL(c), 0LL)
#define SZ(c) ((int)(c).size())
#define CIN(c) cin >> (c)
#define COUT(c) cout << (c) << '\n'
#define debug(x) cerr << #x << " = " << (x) << '\n';
using P = pair<ll, ll>;
using VP = vector<P>;
using VVP = vector<VP>;
using VS = vector<string>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<ll>;
using VVLL = vector<VLL>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VD = vector<double>;
using VVD = vector<VD>;
static const double EPS = 1e-10;
static const double PI = acos(-1.0);
static const ll MOD = 1000000007;
// static const ll MOD = 998244353;
static const int INF = (1 << 30) - 1; // 1073741824 - 1
// static const ll INF = (1LL << 60) - 1;  // 4611686018427387904 - 1

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, w;
    cin >> n >> w;
    COUT(n / w);
}
#include <bits/stdc++.h>
using namespace std;

int main()
{
  int64_t N, K;
  cin >> N >> K;
  if(K < 0) K = -K;
  
  int64_t X, Y;
  int64_t countx, county;
  int64_t count = 0;
  
  for(int i = 2 * N - K - 1; i > 0; i--)
  {
    X = 2 * N - (2 * N - K - 1 - i);
    Y = X - K;
    if(N < X - 1) countx = X - 1 - (2 * (X - 1) - 2 * N);
    else countx = X - 1;
    if(N < Y - 1) county = Y - 1 - (2 * (Y - 1) - 2 * N);
    else county = Y - 1;
    count += countx * county;
  }
  
  cout << count << endl;
}