#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9 + 7;
void solve() {
  long long n, m;
  cin >> n >> m;
  if (m == 1) {
    long long a = n * (n - 1) / 2;
    cout << a << " " << a << endl;
  } else {
    long long aux = n - (m - 1);
    long long maxi = aux * (aux - 1) / 2;
    long long mini = 0;
    aux = n / m;
    long long left = n - m * aux;
    if (left != 0) {
      mini = (aux + 1) * aux / 2 * left + (m - left) * (aux * (aux - 1)) / 2;
    } else {
      mini = (aux * (aux - 1)) / 2 * m;
    }
    cout << mini << " " << maxi << endl;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
