#include <bits/stdc++.h>
using namespace std;
long long int n, m;
long long int l, nol, r, nor, ans;
void Solve() {
  cin >> n >> m;
  ans = 0;
  l = r = n / m;
  if (n % m != 0) l++, nol = n % m;
  nor = m - nol;
  ans += (nol * ((l * (l - 1)) / 2));
  ans += (nor * ((r * (r - 1)) / 2));
  cout << ans << " ";
  r = n - (m - 1);
  cout << ((r * (r - 1)) / 2) << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  Solve();
  return 0;
}
