#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m;
  cin >> n >> m;
  if (n == m) {
    cout << 0 << " " << 0;
    return 0;
  }
  if (n == m + 1) {
    cout << 1 << " " << 1;
    return 0;
  }
  long long x = n / m;
  long long r = n % m;
  cout << r * (x * x + x) / 2 + (m - r) * (x * x - x) / 2 << " "
       << ((n - m) * (n - m + 1)) / 2 << "\n";
  return 0;
}
