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