#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long int n, x, tim = 0;
  cin >> n >> x;
  vector<long long int> c(n, 0);
  for (long long int i = 0; i < n; i++) {
    cin >> c[i];
  }
  sort(c.begin(), c.end());
  for (long long int k : c) {
    tim += k * x;
    x--;
    x = max(1LL, x);
  }
  cout << tim;
  return 0;
}
