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