#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long n, m;
  cin >> n >> m;
  long long rem = m - 1;
  long long big = n - rem;
  long long mx = (big * (big - 1)) / 2;
  long long parts = n / m;
  long long mn = m * (parts * (parts - 1)) / 2;
  mn += parts * (n % m);
  cout << mn << " " << mx << endl;
  return 0;
}
