#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, mini, maxi;
  cin >> n >> m;
  long long x = n / m;
  long long rem = n - (x * m);
  mini = rem * (x * (x + 1)) / 2 + (m - rem) * (x * (x - 1)) / 2;
  maxi = ((n - m + 1) * (n - m)) / 2;
  cout << mini << " " << maxi;
}
