#include <bits/stdc++.h>
using namespace std;
void debug(istream_iterator<string> it) {}
template <typename T, typename... Args>
void debug(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  debug(++it, args...);
}
long long dbg_cnt = 0;
long long nc2(long long a) { return a * (a - 1) / 2; }
void solve() {
  long long n, m;
  cin >> n >> m;
  long long max = (n - m + 1) * (n - m) / 2;
  long long perGrp = n / m;
  long long outStanding = n % m;
  long long min =
      outStanding * nc2(perGrp + 1) + (m - outStanding) * nc2(perGrp);
  cout << min << " " << max;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
