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