#include <bits/stdc++.h>
using namespace std;
string fix = "0123456789";
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1, -1, 1, -1, 0, 0, -1, 1};
int fx[] = {1, -1, 0, 0};
int fy[] = {0, 0, 1, -1};
int main() {
  long long n, m;
  cin >> n >> m;
  long long pairr = n / m;
  long long mod = n % m;
  long long mn = n - (m - 1);
  mn--;
  pairr--;
  long long pp = pairr + 1;
  cout << ((pairr * (pairr + 1) / 2) * (m - mod)) + (pp * (pp + 1) / 2) * mod
       << " ";
  cout << mn * (mn + 1) / 2 << " ";
}
