#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, min_res, max_res;
  cin >> n >> m;
  long long x = n - (m - 1);
  max_res = x * (x - 1) / 2;
  long long y1 = n / m;
  if (n % m == 0)
    min_res = y1 * (y1 - 1) / 2 * m;
  else {
    long long r = n % m;
    long long n1, n2;
    n1 = r;
    n2 = m - n1;
    min_res = (((y1 + 1) * y1 / 2) * n1) + ((y1 * (y1 - 1) / 2) * n2);
  }
  cout << min_res << " " << max_res << endl;
  return 0;
}
