#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, x, c = 0, k;
  vector<long long> a;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> x;
    a.push_back(x);
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < n; i++) {
    c += k * a[i];
    if (k > 1) k--;
  }
  cout << c;
}
