#include <bits/stdc++.h>
#pragma GCC optimize(3, "Ofast", "inline")
using namespace std;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, m;
  cin >> n >> m;
  long long kmax = ((n - m + 1) * (n - m)) / 2;
  long long kmin = 0;
  long long d = n / m;
  long long r = n % m;
  for (long long i = 0; i < r; i++) {
    kmin += ((d + 1) * d) / 2;
  }
  long long l = m - r;
  for (long long j = 0; j < l; j++) {
    kmin += ((d) * (d - 1)) / 2;
  }
  cout << kmin << " " << kmax;
  return 0;
}
