#include <bits/stdc++.h>
using namespace std;
int a[110];
int main() {
  int n, d, t, m, s, sum;
  while (scanf("%d%d", &n, &d) != EOF) {
    s = 0;
    for (t = sum = 0; t < n; ++t) {
      scanf("%d", a + t);
      sum += a[t];
    }
    scanf("%d", &m);
    sort(a, a + n);
    if (m <= n) {
      for (t = 0; t < m; ++t) s += a[t];
    } else {
      s = sum - d * (m - n);
    }
    printf("%d\n", s);
  }
  return 0;
}
