#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long s = 0, n, m, a = 0, d, t;
  cin >> n >> d;
  vector<long long> v;
  for (long long i = 0; i < n; i++) {
    cin >> t;
    s += t;
    v.push_back(t);
  }
  cin >> m;
  if (n == m) {
    cout << s;
    return 0;
  }
  sort(v.begin(), v.end());
  if (m < n) {
    for (long long i = 0; i < m; i++) {
      a += v[i];
    }
    cout << a;
    return 0;
  }
  if (m > n) {
    long long fine = (m - n) * d;
    cout << s - (fine);
    return 0;
  }
}
