#include <bits/stdc++.h>
using namespace std;
string FILE_NAME = "testcase.B";
string NAME;
string itos(int n) {
  stringstream ss;
  ss << n;
  return ss.str();
}
int main() {
  ios_base::sync_with_stdio(0);
  int N, X;
  cin >> N >> X;
  vector<int> c(N, 0);
  for (int i = 0; i < (N); i++) cin >> c[i];
  sort(c.begin(), c.end());
  long long res = 0LL;
  for (int i = 0; i < (N); i++) {
    res += (long long)X * c[i];
    if (X > 1) X--;
  }
  cout << res << endl;
  return 0;
}
