#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
const long long MOD = 1e9 + 7;
const double EPS = (1e-8);
const int OO = (int)1e9 + 7;
const long long OOO = (long long)1e15 + 7;
double const PI = 3.1415926535897932384626433832795;
const int mxn = 200009;
char c1, c2, c3, c4;
string s, s1, s2, s3;
long long n, m, k, t, q, a, b, c, d, e, x, y, z;
long long sol = 0;
int ar[1111];
int main() {
  fast();
  cin >> n >> d;
  for (int i = 0; i < n; i++) cin >> ar[i];
  sort(ar, ar + n);
  for (int i = 1; i < n; i++) ar[i] += ar[i - 1];
  cin >> m;
  if (m <= n) {
    cout << ar[m - 1];
  } else {
    cout << ar[n - 1] - (d * (m - n));
  }
  cout << endl << endl;
  return 0;
}
