#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;
const double pi = acos(-1.0);
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  long long a = n - m + 1, b = n / m, c = n % m;
  long long maxn = a * (a - 1) / 2;
  long long minn = c * b * (b + 1) / 2 + (m - c) * b * (b - 1) / 2;
  printf("%lld %lld\n", minn, maxn);
  return 0;
}
