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