#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  unsigned long long n, k, b;
  unsigned long long s = 0;
  cin >> n >> k;
  unsigned long long a[n];
  for (unsigned long long i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  for (unsigned long long i = 0; i < n; i++) {
    s += a[i] * k;
    if (k > 1) k--;
  }
  cout << s;
}
