#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
long long n, x, c[MAXN], res = 0;
int main() {
  cin >> n >> x;
  for (int i = 0; i < n; i++) cin >> c[i];
  sort(c, c + n);
  for (int i = 0; i < n; i++, x--) res += max(x, 1LL) * c[i];
  cout << res;
}
