#include <bits/stdc++.h>
using namespace std;
bool Devu(int a, int b) {
  if (a < b) return true;
  return false;
}
int main() {
  vector<long long> a;
  int n, t;
  int temp = 0;
  long long s = 0, x;
  cin >> n >> x;
  a.push_back(0);
  for (int i = 1; i <= n; i++) {
    cin >> t;
    a.push_back(t);
  }
  sort(a.begin(), a.end(), Devu);
  for (int i = 1; i <= n; i++) {
    if (x == 0) {
      s += a[i];
    } else {
      s += a[i] * x;
      x--;
    }
  }
  cout << s;
  return 0;
}
