#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, x, c = 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++) {
    c += arr[i] * x;
    if (x > 1) x--;
  }
  cout << c;
  return 0;
}
