#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  long long a, b;
  a = (n / m) * (n / m - 1) * (m - n % m) / 2 +
      (n / m + 1) * (n / m) * (n % m) / 2;
  b = (n - m + 1) * (n - m) / 2;
  cout << a << ' ' << b << '\n';
}
