#include <bits/stdc++.h>
using namespace std;
const int mod = (long long)1e9 + 7;
long long power(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret *= a;
    a *= a;
    if (ret >= mod) ret %= mod;
    if (a >= mod) a %= mod;
    b >>= 1;
  }
  return ret;
}
long long inv(long long x) { return power(x, mod - 2); }
int main() {
  ios_base::sync_with_stdio(false);
  long long n, d, k, cnt = 0, l;
  cin >> n >> d;
  priority_queue<long long, vector<long long>, greater<long long> > p;
  for (long long i = 0; i < n; i++) {
    cin >> k;
    p.push(k);
    cnt += k;
  }
  cin >> k;
  if (k < n) {
    cnt = 0;
    for (long long i = 0; i < k; i++) {
      l = p.top();
      p.pop();
      cnt += l;
    }
  } else {
    n = k - n;
    cnt -= d * n;
  }
  cout << cnt << "\n";
}
