#include <bits/stdc++.h>
using namespace std;
const int LIM = 1e+5 + 100;
long long a[LIM];
int main() {
  long long n, x;
  cin >> n >> x;
  for (int i = 0; i < n; ++i) cin >> a[i];
  sort(a, a + n);
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    ans += a[i] * x;
    x = max(x - 1, 1LL);
  }
  cout << ans;
  return 0;
}
