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