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