#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  if (n == m)
    cout << 0 << " " << 0;
  else if (m == 1)
    cout << (n - 1) * n / 2 << " " << (n - 1) * n / 2;
  else {
    long long max;
    max = (n - m + 1) * (n - m) / 2;
    long long min, cat, rest, dif;
    cat = n / m;
    rest = n % m;
    dif = m - rest;
    min = (cat + 1) * cat / 2 * rest + cat * (cat - 1) / 2 * dif;
    cout << min << " " << max;
  }
}
