#include <bits/stdc++.h>
int main() {
  long long int n, m, max = 0, min = 0, i, k, j, r;
  scanf("%lld %lld", &n, &m);
  i = n - m;
  max = (i * (i + 1)) / 2;
  k = n / m;
  r = n % m;
  min = r * ((k * (k + 1)) / 2) + (m - r) * ((k * (k - 1)) / 2);
  printf("%lld %lld\n", min, max);
  return 0;
}
