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