#include <bits/stdc++.h>
using namespace std;
const long long int Mod = 998244353;
int main() {
  long long int n, m, x, y, z, a, b;
  cin >> n >> m;
  if (m == 1) {
    x = n * (n - 1) / 2;
    cout << x << " " << x << endl;
  } else {
    if (n % m == 0) {
      y = n / m;
      y = y * (y - 1) / 2;
      y = y * m;
    } else {
      z = n % m;
      y = n / m;
      a = y * (y + 1) / 2;
      b = y * (y - 1) / 2;
      y = (a * z) + (b * (m - z));
    }
    m = m - 1;
    n = n - m;
    x = n * (n - 1) / 2;
    cout << y << " " << x << endl;
  }
}
