#include <bits/stdc++.h>
using namespace std;
long long int NCR(long long int n, long long int r) {
  if (n < r) return 0;
  if (n == r) return 1;
  if (r == 0) return 1;
  if (r > n / 2) return NCR(n, n - r);
  long long int res = 1;
  for (int k = 1; k <= r; ++k) {
    res *= n - k + 1;
    res /= k;
  }
  return res;
}
int main() {
  std::ios::sync_with_stdio(false);
  long long int n, m;
  cin >> n >> m;
  long long int kmax = NCR((n - (m - 1)), 2);
  long long int kmin;
  if (m == 1)
    kmin = NCR(n, 2);
  else if (n == m)
    kmin = 0;
  else
    kmin = ((n % m) * NCR((n / m) + 1, 2)) + ((m - (n % m)) * (NCR(n / m, 2)));
  cout << kmin << " " << kmax;
  return 0;
}
