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