#include <bits/stdc++.h>
int main() {
  long long int n, m, i, temp1, temp2, kmax, kmin;
  scanf("%I64d %I64d", &n, &m);
  long long int r = n % m, div = n / m;
  if (r == 0) {
    if (div == 1)
      kmin = 0;
    else
      kmin = m * (div * (div - 1)) / 2;
  } else {
    kmin = r * (((div + 1) * (div)) / 2) + (m - r) * ((div * (div - 1)) / 2);
  }
  temp1 = n - m + 1;
  kmax = (temp1 * (temp1 - 1)) / 2;
  printf("%I64d %I64d\n", kmin, kmax);
  return 0;
}
