#include <bits/stdc++.h>
using namespace std;
const double PI = std::atan(1.0) * 4;
int main(int argc, char* argv[]) {
  long long int n, x;
  cin >> n >> x;
  vector<long long int> elems(n);
  for (int i = 0; i < n; ++i) {
    cin >> elems[i];
  }
  sort(elems.begin(), elems.end());
  long long int ans = 0;
  for (int i = 0; i < n; ++i) {
    ans += elems[i] * x;
    x = max(1LL, x - 1);
  }
  cout << ans << endl;
  return EXIT_SUCCESS;
}
