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