Sereja owns a restaurant for n people. The restaurant hall has a coat rack with n hooks. Each restaurant visitor can use a hook to hang his clothes on it. Using the i-th hook costs a_{i} rubles. Only one person can hang clothes on one hook.

Tonight Sereja expects m guests in the restaurant. Naturally, each guest wants to hang his clothes on an available hook with minimum price (if there are multiple such hooks, he chooses any of them). However if the moment a guest arrives the rack has no available hooks, Sereja must pay a d ruble fine to the guest. 

Help Sereja find out the profit in rubles (possibly negative) that he will get tonight. You can assume that before the guests arrive, all hooks on the rack are available, all guests come at different time, nobody besides the m guests is visiting Sereja's restaurant tonight.


-----Input-----

The first line contains two integers n and d (1 ≤ n, d ≤ 100). The next line contains integers a_1, a_2, ..., a_{n} (1 ≤ a_{i} ≤ 100). The third line contains integer m (1 ≤ m ≤ 100).


-----Output-----

In a single line print a single integer — the answer to the problem.


-----Examples-----
Input
2 1
2 1
2

Output
3

Input
2 1
2 1
10

Output
-5



-----Note-----

In the first test both hooks will be used, so Sereja gets 1 + 2 = 3 rubles.

In the second test both hooks will be used but Sereja pays a fine 8 times, so the answer is 3 - 8 =  - 5.

Difficulty: interview

Starter code:

Solutions:
n,d=list(map(int,input().split()))

A=list(map(int,input().split()))

m=int(input())

A.sort()

if(m<=n):
    print(sum(A[:m]))

else:
    print(sum(A)-(d*(m-n)))


n, d = list(map(int, input().split()))
a = list(map(int, input().split()))
m = int(input())
a.sort()
ans = 0
for i in range(m):
    if (i < n):
        ans += a[i]
    else:
        ans -= d
print(ans)


n,d = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
m = int(input())
print(sum(a[:min(n,m)])-d*(max(0,m-n)))

__author__ = 'sm'
#import sys
#fin = open('data.in','r')
#fout = open("data.out",'w')
#sys.stdin = fi:w
# n
#sys.stdout = fout

def readln():
    return list(map(int,input().split()))


n,d = readln()
data =  readln()
m = readln()[0]


data.sort()
cost = 0
j = 0
for i in range(m):
    if i >=  len(data):
        cost -= d
    else:
        cost += data[i]

print (cost)





import sys

def __starting_point():

    n, d = [int(i) for i in sys.stdin.readline().rstrip().split(' ')]
    a_arr = sorted([int(i) for i in sys.stdin.readline().rstrip().split(' ')])
    m = int(sys.stdin.readline().rstrip())

    if m <= n:
        # enough hooks
        print(sum(a_arr[:m]))
    else:
        print(sum(a_arr)-(m-n)*d)

__starting_point()

#!/usr/local/bin/python3

n, d = list(map(int, input().split()))
a = list(map(int, input().split()))
m = int(input())

a.sort()

if m <= n:
	result = sum(a[:m])
else:
	result = sum(a) - (m-n)*d

print(result)



tmp = [int(i) for i in input().split()];
n = tmp[0];
d = tmp[1];

a = [int(i) for i in input().split()];
a.sort();
m = int(input());

out = 0;

for i in range(0,m):
    if i < len(a):
        out = out + a[i];
    else:
        out = out - d;

print(out);

def main():
	l=input().split(' ')
	n,d=int(l[0]),int(l[1])
	k=input().split(' ')
	for x in range(0,n):
		k[x]=int(k[x])
	k.sort()
	m=int(input())
	sume=0
	if n>=m:
		for x in range(0,m):
			sume=sume+k[x]
	else :
		for x in range(0,n):
			sume=sume+k[x]
		sume=sume-((m-n)*d)
	print(sume)
def __starting_point():
	main()
__starting_point()

n, d = list(map(int, input().split()))
A = list(map(int, input().split()))
m = int(input())
if m < n:
    A = sorted(A)
    print(sum(A[:m]))
else:
    print(sum(A) - d * (m - n))


n, d = [int(i) for i in input().split(' ')]
ai = [int(i) for i in input().split(' ')]
m = int(input())

if m >= n:
    print(sum(ai) - (m - n) * d)
else:
    print(sum(sorted(ai)[:m]))


n, d = map(int, input().split())
a = list(map(int, input().split()))
a.sort()

m = int(input())
ans = sum(a[:m])
ans -= (max(0,m-n))*d
print(ans)

3

def readln(): return tuple(map(int, input().split()))

n, d = readln()
a = sorted(readln())
m, = readln()
if m <= n:
    print(sum(a[:m]))
else:
    print(sum(a) - (m - n) * d)


n,d=map(int,input().split())
a=list(map(int,input().split()))
m=int(input())
a.sort()
print(sum(a[:min(n,m)])-max(0,m-n)*d)

#!/usr/bin/env python3
# -*- coding: utf8 -*-

import fileinput

def solve():
    with fileinput.input() as stdin:
        n, d = [int(c) for c in stdin.readline().split(" ")]
        a = [int(c) for c in stdin.readline().split(" ")]
        m = int(stdin.readline())
        a = sorted(a)
        # print(n, d, a, m)

        res = 0
        if (m > n):
            res = sum(a)
            res -= (m - n) * d
        else:
            for i in range(m):
                res += a[i]
        print(res)

def __starting_point():
    solve()

__starting_point()


def main(stdin):
    n, d = next(stdin).split()
    n, d = int(n), int(d)
    a_i = sorted(map(int, next(stdin).split()))
    m = int(next(stdin))
    lost = 0

    a_sum = sum(int(a_i[i]) for i in range(min(m, n)))
    if n < m:
        lost = d * (m - n)
    print(a_sum - lost)


def __starting_point():
    import sys
    main(sys.stdin)

__starting_point()

array= input("").split(' ')
totalsum=0 # to be used for m<n
summ=0 # to be used for m>=n

n=array[0]
d=array[1]
listfromsmallesttolargest=input("").split(' ')
m=int(input(""))
for u in range (0, len(listfromsmallesttolargest)):
    summ=summ+int(listfromsmallesttolargest[u])
listfromsmallesttolargest=[int(x) for x in listfromsmallesttolargest]
listfromsmallesttolargest.sort()
if (int(m)>=int(n)):
    print(summ-int(d)*(int(m)-int(n)))
if (int(m) < int(n)):
    for bub in range (0,int(m)):
        totalsum=totalsum+int(listfromsmallesttolargest[bub])    
    print(totalsum)


n, d = list(map(int, input().split()))
a = list(map(int, input().split()))
m = int(input())
s = 0
if m > n:
	s -= (m - n) * d
a.sort()
for i in range(min(n, m)):
	s += a[i]
print(s)


#!/usr/bin/env python3

n, d = (int(x) for x in input().split(None, 2))
a = [int(x) for x in input().split()]
assert len(a) == n
m = int(input())

if n <= m:
    print(sum(a) - d * (m-n))
else:
    a.sort()
    print(sum(a[:m]))


#!/usr/bin/env python3

n, d = tuple(map(int, input().split(None, 2)))
a = list(map(int, input().split()))
assert len(a) == n
m = int(input())

a.sort()
if n <= m:
    print(sum(a) - d * (m - n))
else:
    print(sum(a[:m]))


M = lambda: map(int, input().split())
L = lambda: list(map(int, input().split()))
I = lambda: int(input())
n, d = M()
a, k = sorted(L()), I()
print(sum(a) + (n - k) * d if n < k else sum(a[: k]))

n, d = list(map(int, input().split()))
a = list(map(int, input().split()))
m = int(input())
if m > n:
    print(sum(a)-(m-n)*d)
else:
    a.sort();
    print(sum(a[0:m]))



# -*- coding: utf-8 -*-

n, d = list(map(int, input().split()))
a = list(map(int, input().split()))
m = int(input())

a.sort()
if m <= n:
    print(sum(a[:m]))
else:
    print(sum(a) - (m-n)*d)


import sys 

n_d = sys.stdin.readline().split()
n = int(n_d[0])
d = int(n_d[1])

lista = sys.stdin.readline().split()
for i in range(n):
	lista[i] = int(lista[i])

m = int(sys.stdin.readline())

count = 0
lista = sorted(lista)
lista.reverse()
while m>0:
	if len(lista)>0:
		count+=lista.pop()
	else:
		count-=d
	m-=1

print(count)

n, d = map(int, input().split())
a = sorted(list(map(int, input().split())))
m = int(input())
print(sum(a[:m])) if m <= n else print(sum(a) - (m-n) * d)