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