#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int m, n, kmax, kmin, t, rem;
  cin >> n >> m;
  kmax = (n - m + 1) * (n - m) / 2;
  t = n / m;
  rem = n % m;
  kmin = rem * (t + 1) * t / 2 + (m - rem) * t * (t - 1) / 2;
  cout << kmin << " " << kmax;
  return 0;
}
