#include <bits/stdc++.h>
using namespace std;
inline int gi() {
  int f = 1, sum = 0;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    sum = (sum << 3) + (sum << 1) + ch - '0';
    ch = getchar();
  }
  return f * sum;
}
long long n, x;
int main() {
  scanf("%lld%lld", &n, &x);
  long long p = (n + x - 1) / x + 1;
  printf("%lld\n", p * (n - x));
  return 0;
}
