#include <bits/stdc++.h>
using namespace std;
const long long MOD = 10e9 + 7;
const long double PI = acos((long double)(-1.0));
const long double EPS = 1e-9;
void read() {
  cin.sync_with_stdio(false);
  cin.tie(0);
}
int main() {
  read();
  long long n, x;
  cin >> n >> x;
  vector<long long> vect(n);
  for (int i = 0; i < n; i++) {
    cin >> vect[i];
  }
  sort(vect.begin(), vect.end());
  int rate = x;
  long long ans_1 = 0, ans_2 = 0;
  for (int i = 0; i < n; i++) {
    ans_1 += vect[i] * rate;
    if (rate > 1) rate--;
  }
  cout << ans_1;
  cerr << "\nTime elapsed " << 1.0 * clock() / CLOCKS_PER_SEC << " secs";
  return 0;
}
