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