#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m;
  cin >> n >> m;
  long long int max_pair = (n - (m - 1)) * (n - (m - 1) - 1) / 2ll;
  long long int min_pair =
      (m * (n / m) * (n / m - 1) / 2ll) + ((n % m) * (n / m));
  cout << min_pair << " " << max_pair << "\n";
  return 0;
}
