#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int m, n;
  scanf("%lld%lld", &n, &m);
  long long int maxv, minv;
  maxv = ((n - m + 1) * (n - m)) / 2ll;
  long long int div = n / m;
  long long int left = n % m;
  minv = (m - left) * (div * (div - 1)) / 2ll + left * (div * (div + 1)) / 2ll;
  printf("%lld %lld\n", minv, maxv);
}
