#include <bits/stdc++.h>
using namespace std;
long long int f(long long int n) { return (n - 1) * (n) / 2LL; }
long long int solve(long long int n, long long int m) {
  if (n % m == 0) return m * f(n / m);
  long long int g1_size = n, g1_number;
  long long int g2_size, g2_number;
  long long int res = 1e18;
  for (int i = 1; i < m; i++) {
    g1_number = m - i;
    g2_number = i;
    long long int quo = (n - g2_number) / g1_number;
    g2_size = n - quo * g1_number;
    g1_size = quo * g1_number;
    if (g2_size >= g2_number) {
      res = min(res, solve(g1_size, g1_number) + solve(g2_size, g2_number));
    }
  }
  return res;
}
int main() {
  long long int n, m;
  cin >> n >> m;
  long long int mx = f(n - (m - 1));
  long long int mn;
  long long int avg = n / m;
  if (n % m) {
    long long int k = m - (n % m);
    mn = (n % m) * f(avg + 1) + k * f(avg);
  } else {
    mn = f(avg) * m;
  }
  cout << mn << " " << mx;
  return 0;
}
