#include <bits/stdc++.h>
using namespace std;
long long nC2(long long n) {
  if (n < 2) return 0;
  return (n * (n - 1) / 2);
}
int main() {
  ios::sync_with_stdio(false);
  long long n, m, minNoOfPairs, maxNoOfPairs;
  cin >> n >> m;
  minNoOfPairs = (m - n % m) * (nC2(n / m)) + (n % m) * (nC2(n / m + 1));
  maxNoOfPairs = nC2(n - m + 1);
  cout << minNoOfPairs << " " << maxNoOfPairs << "\n";
  return 0;
}
