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