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