#include <bits/stdc++.h>
using namespace std;
long long int combination(long long int n) {
  long long int ans;
  if (n == 2) {
    return 1;
  } else if (n < 2) {
    return 0;
  }
  ans = n * (n - 1) / 2;
  return ans;
}
int main() {
  long long int m, n, max_friends, ans_max, ans_min = 0, q, r, temp;
  cin >> n >> m;
  max_friends = n - (m - 1);
  ans_max = combination(max_friends);
  q = n / m;
  r = n % m;
  ans_min = r * combination(q + 1) + (m - r) * combination(q);
  cout << ans_min << " " << ans_max << endl;
  return 0;
}
