#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, m;
  cin >> n >> m;
  long long x = n - (m - 1);
  long long y = n / m;
  long long rem = n % m;
  long long kmax = (x * (x - 1)) / 2, kmin = 0;
  if (rem == 0) {
    kmin = (y * (y - 1) * m) / 2;
  } else {
    int count = 0;
    while (rem--) {
      kmin += (y * (y + 1)) / 2;
      ++count;
    }
    kmin += (y * (y - 1) * (m - count)) / 2;
  }
  cout << kmin << " " << kmax << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
