#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m;
  cin >> n >> m;
  long long int x = n - (m - 1);
  long long int max = (x * (x - 1)) / 2;
  long long int minimum;
  long long int divi;
  long long int remain;
  divi = n / m;
  remain = n % m;
  minimum = (m - remain) * ((divi * (divi - 1)) / 2) +
            remain * (((divi + 1) * divi) / 2);
  cout << minimum << " " << max;
}
