#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m;
  cin >> n >> m;
  long long int b = n - m + 1;
  long long int kmax = b * (b - 1) / 2;
  long long int kmin;
  long long int c = n / m;
  long long int d = n % m;
  kmin = (m - d) * c * (c - 1) / 2 + d * (c + 1) * (c) / 2;
  cout << kmin << " " << kmax;
}
