#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int n,d; cin >> n >>d; vector<int>a(n); for(int i = 0; i < n ; ++ i ) cin >>a[i]; int m; cin >> m; sort(a.begin(),a.end()); int sum = 0; if(m <=n){ for(int i = 0 ; i < m; ++ i) sum+=a[i]; } else{ for(int i = 0 ; i < n; ++ i) sum+=a[i]; sum -= d*(m-n); } cout<<sum<<endl; return 0; }