#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n = 0;
  long long m = 0;
  cin >> n;
  cin >> m;
  long long p = n / m;
  long long r = n % m;
  long long pm = n - m;
  long long kmax = pm * (pm + 1) / 2;
  long long kmin = r * (p + 1) * p / 2 + (m - r) * p * (p - 1) / 2;
  cout << kmin << " " << kmax;
  return 0;
}
