#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
template <typename T>
void print(vector<T> v) {
  for (T &i : v) cout << i << " ";
  cout << "\n";
}
void solve() {
  unsigned long long int n, x;
  cin >> n >> x;
  vector<unsigned long long int> v(n);
  for (unsigned long long int &i : v) cin >> i;
  sort(v.begin(), v.end());
  unsigned long long int sum = 0;
  for (unsigned long long int i : v) {
    sum += i * x;
    if (x > 1) x--;
  }
  cout << sum << "\n";
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int tcs = 1;
  while (tcs--) solve();
  return 0;
}
