#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x;
  long long int answer = 0;
  long long int arr[100006];
  cin >> n >> x;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  for (int i = 0; i < n; i++) {
    answer += arr[i] * max(x - i, 1);
  }
  cout << answer << endl;
  return 0;
}
