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