#include <bits/stdc++.h>
int compare_int(const void *a, const void *b) {
  const int *da = (const int *)a;
  const int *db = (const int *)b;
  return (*da > *db) - (*da < *db);
}
int main() {
  int n, d, m, sum = 0, i;
  scanf("%d", &n);
  scanf("%d", &d);
  int a[n];
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  scanf("%d", &m);
  qsort(a, n, sizeof(int), compare_int);
  if (m <= n) {
    for (i = 0; i < m; i++) sum += a[i];
    printf("%d", sum);
  } else {
    for (i = 0; i < n; i++) sum += a[i];
    printf("%d", sum - d * (m - n));
  }
  return 0;
}
