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