#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, x, sum = 0;
  cin >> n >> x;
  long long arr[n];
  for (long long i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  for (long long i = 0; i < n; i++) {
    if (x >= 2) {
      sum += x * arr[i];
      x--;
    } else
      sum += arr[i];
  }
  cout << sum;
}
