#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m;
  cin >> n >> m;
  long long int kmx = 0;
  kmx = ((n - (m - 1)) * (n - m)) / 2;
  long long int kmn = 0;
  long long int y = n / m;
  long long int j = n % m;
  for (long long int i = 0; i < j; i++) {
    kmn += ((y * (y + 1)) / 2);
  }
  for (long long int i = 0; i < (m - j); i++) {
    kmn += (y) * (y - 1) / 2;
  }
  cout << kmn << " " << kmx;
}
