#include <bits/stdc++.h>
using namespace std;
bool comp(pair<int, int> a, pair<int, int> b) { return a.first < b.first; }
int main() {
  long long n, x;
  cin >> n >> x;
  vector<long long> tab(n, 0);
  for (int i = int(0); i < int(n); ++i) cin >> tab[i];
  sort((tab).begin(), (tab).end());
  long long sum = 0;
  for (int i = int(0); i < int(n); ++i) {
    sum += x * tab[i];
    x = max(x - 1, (long long)1);
  }
  cout << sum << endl;
  return 0;
}
