#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 5;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, m;
  cin >> n >> m;
  long long k = (n / m) + bool(n % m);
  long long p, q, mmin;
  if (n % m != 0) {
    p = m - (n % m);
    q = m - p;
    mmin = ((k * (k - 1)) / 2) * q + (((k - 1) * (k - 2)) / 2) * p;
  } else {
    mmin = ((k * (k - 1)) / 2) * m;
  }
  long long l = n - m + 1;
  long long mmax = (l * (l - 1)) / 2;
  cout << mmin << " " << mmax;
}
