#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, x, i, vl, h = 0;
  cin >> n >> x;
  vector<long long> v;
  for (i = 0; i < n; i++) {
    cin >> vl;
    v.push_back(vl);
  }
  sort(v.begin(), v.end());
  for (i = 0; i < n; i++) {
    h += v[i] * x;
    if (x > 1) x--;
  }
  cout << h;
  return 0;
}
