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