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