#include <bits/stdc++.h>
using namespace std;
inline int64_t nC2(int64_t n) { return (n * (n - 1)) / 2; }
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  int64_t n, m;
  cin >> n >> m;
  int64_t max = nC2(n - (m - 1));
  int64_t min = (n % m) * nC2((n / m) + 1) + (m - n % m) * nC2(n / m);
  cout << min << " " << max << "\n";
  return 0;
}
