#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long x, ans = 0, c[100005];
  scanf("%d %I64d", &n, &x);
  for (int i = 1; i <= n; i++) scanf("%I64d", &c[i]);
  sort(c + 1, c + n + 1);
  for (int i = 1; i <= n; i++) {
    ans += x * c[i];
    x = max((long long)1, x - 1);
  }
  printf("%I64d\n", ans);
  return 0;
}
