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