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