#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, m;
  cin >> n >> m;
  long long vmax = n - (m - 1);
  long long kmax = vmax * (vmax - 1) / 2;
  long long vmin = n / m;
  long long vmin_add = n - vmin * m;
  long long kmin =
      (m - vmin_add) * vmin * (vmin - 1) / 2 + vmin_add * (vmin + 1) * vmin / 2;
  cout << kmin << " " << kmax;
  return 0;
}
