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