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