#include <bits/stdc++.h>
using namespace std;
inline bool cmp(const pair<int, int> &a, const pair<int, int> &b) {
  if (a.first != b.first) return a.first > b.first;
  return a.second < b.second;
}
int a[1000005], b[1000005];
char s[1000005], r[1000005];
int test;
int main() {
  int t, n, m, k, l, x, y, z, flag = 0, count = 0, d, mx, mn;
  long long int sum = 0, prod = 1;
  scanf("%d%d", &n, &d);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  scanf("%d", &m);
  sort(a, a + n);
  x = ((n) < (m) ? (n) : (m));
  for (int i = 0; i < x; i++) sum += a[i];
  if (m > n) sum -= (m - n) * d;
  printf("%lld", sum);
  return 0;
}
