#include <bits/stdc++.h>
using namespace std;
int main() {
  long long unsigned n, m, res, rem, k_min, k_max;
  cin >> n >> m;
  res = n / m;
  rem = n % m;
  k_min = rem * (res + 1) * (res) / 2 + (m - rem) * res * (res - 1) / 2;
  k_max = (n - m + 1) * (n - m) / 2;
  cout << k_min << " " << k_max << endl;
  return 0;
}
