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