#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  scanf("%I64d%I64d", &n, &m);
  long long min_ans, max_ans;
  if (m == 1)
    min_ans = max_ans = n * (n - 1) / 2;
  else if (n / m != 1) {
    long long num;
    num = n / m;
    min_ans = m * (num - 1) * num / 2 + n % m * num;
    max_ans = (n - m + 1) * (n - m) / 2;
  } else if (n / m == 1) {
    min_ans = n - m;
    max_ans = (n - m + 1) * (n - m) / 2;
  }
  printf("%I64d %I64d\n", min_ans, max_ans);
}
