#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  long long k = n - m + 1;
  long long ans1 = (k * (k - 1)) / 2;
  if (m == 1) {
    cout << ans1 << " " << ans1;
    return 0;
  }
  long long t = n / m;
  long long l = n % m;
  long long f = (t * (t - 1)) / 2;
  t++;
  long long ff = (t * (t - 1)) / 2;
  long long ans2 = l * ff + (m - l) * f;
  cout << min(ans1, ans2) << " " << max(ans1, ans2);
}
