#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, l, r, kmin, kmax, q, s;
  cin >> n >> m;
  q = n - (m - 1);
  kmax = ((q * (q - 1)) / 2);
  l = (n / m);
  r = n - (l * (m - 1));
  if (r == l)
    kmin = (((l * (l - 1)) / 2) * m);
  else if (r < l) {
    s = l - r;
    kmin = (((l * (l - 1)) / 2) * (m - s)) + ((((l - 1) * (l - 2)) / 2) * s);
  } else {
    s = r - l;
    kmin = (((l * (l - 1)) / 2) * (m - s)) + ((((l + 1) * l) / 2) * s);
  }
  cout << kmin << " " << kmax;
  return 0;
}
