#include <bits/stdc++.h>
using namespace std;
long long nC2(int n) {
  if (n == 0) return 0;
  return ((long long)n * (n - 1)) / 2;
}
void solve() {
  int n, m;
  scanf("%d %d", &n, &m);
  long long Kmin, Kmax;
  int r = n % m;
  Kmin = nC2((n + m - 1) / m) * r + nC2(n / m) * (m - r);
  Kmax = nC2(n - m + 1);
  printf("%lld %lld\n", Kmin, Kmax);
}
int main() {
  int tt;
  tt = 1;
  for (int i = 0; i < tt; ++i) {
    solve();
  }
  return 0;
}
