#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, a, b, t, kmin, kmax;
  cin >> n >> m;
  a = n / m;
  b = n % m;
  kmin = (a - 1) * a / 2 * (m - b) + a * (a + 1) / 2 * b;
  t = n - m + 1;
  kmax = (t - 1) * t / 2;
  cout << kmin << " " << kmax;
}
