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