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