#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
  long long n, m, mm, mi;
  cin >> n >> m;
  mm = ((n - m) * (n - m + 1)) / 2;
  if (m == 1 || m == n - 1)
    mi = mm;
  else if (m >= n / 2)
    mi = n - m;
  else {
    long long kk, count = 0;
    mi = 0;
    count = n - ((n / m) * m);
    n -= count;
    kk = n / m;
    long long nk = kk + 1;
    mi = ((nk * (nk - 1)) / 2) * count;
    m = m - count;
    mi += ((kk * (kk - 1)) / 2) * m;
  }
  cout << mi << " " << mm << endl;
  return 0;
}
