As we all know, Winnie-the-Pooh just adores honey. Ones he and the Piglet found out that the Rabbit has recently gotten hold of an impressive amount of this sweet and healthy snack. As you may guess, Winnie and the Piglet asked to come at the Rabbit's place. Thus, there are n jars of honey lined up in front of Winnie-the-Pooh, jar number i contains ai kilos of honey. Winnie-the-Pooh eats the honey like that: each time he chooses a jar containing most honey. If the jar has less that k kilos of honey or if Winnie-the-Pooh has already eaten from it three times, he gives the jar to Piglet. Otherwise he eats exactly k kilos of honey from the jar and puts it back. Winnie does so until he gives all jars to the Piglet. Count how much honey Piglet will overall get after Winnie satisfies his hunger.

Input

The first line contains two integers n and k (1 ≤ n ≤ 100, 1 ≤ k ≤ 100). The second line contains n integers a1, a2, ..., an, separated by spaces (1 ≤ ai ≤ 100).

Output

Print a single number — how many kilos of honey gets Piglet.

Examples

Input

3 3
15 8 10


Output

9
import java.io.*;
import java.util.*;
import java.text.*;
import java.util.regex.*;
/**
 * Problem-(#) - Main.java
 *
 * @author Isuru Madushanka Weerarathna
 * @team CSECodersV2
 * @written 2011/10/22
 * @competetion IEEEXtreme 5.0
 */


public class Main {

    public static void main(String[] args) {
        try {
            new Main().solve();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void solve() throws IOException {
        BufferedReader reader = new BufferedReader(new FileReader("input.txt"));
        PrintWriter out = new PrintWriter(new FileWriter("output.txt"));

        int[] sz = getAsInt(reader.readLine().split("[ ]+"));
        int[] jars = getAsInt(reader.readLine().split("[ ]+"));

        PairList plist = new PairList();
        Comparator<Pair> comp = new Comparator<Pair>() {
            public int compare(Pair p1, Pair p2) {
                if (p1 == null) return -1; if (p2 == null) return 1;
                int p = 0;
                if (p1.v1>p2.v1) return -1; if (p1.v1<p2.v1) return 1;
                if (p1.v2>p2.v2) return -1; if (p1.v2<p2.v2) return 1;
                return 0;
            }
        };
        int n=sz[0];
        int k=sz[1];
        for (int i=0;i<n;i++) {
            plist.add(new Pair(jars[i], 0));
        }
        plist.sort(comp);

        int piglet = 0;
        int p = 0;
        Pair pair = plist.pairs.get(p);
        while (pair.v1>0) {

            if (pair.v1<k || pair.v2>=3) {
                piglet += pair.v1;
                pair.v1 = 0;
            } else {
                pair.v1 -= k;
                pair.v2 = pair.v2 + 1;
            }

            plist.sort(comp);
            pair = plist.pairs.get(p);
        }
        out.println(piglet);

        out.flush();
        out.close();
        reader.close();
    }

    private int[] getAsInt(String[] parts) {
        int[] res = new int[parts.length];
        for (int i = 0; i<parts.length; i++) res[i] = Integer.parseInt(parts[i]);
        return res;
    }
    private double[] getAsDouble(String[] parts) {
        double[] res = new double[parts.length];
        for (int i = 0; i<parts.length; i++) res[i] = Double.parseDouble(parts[i]);
        return res;
    }
}

class PairList {

    List<Pair> pairs = new ArrayList<Pair>();

    void add(Pair p) {
        pairs.add(p);
    }
    void add(int value1, int value2) {
        pairs.add(new Pair(value1, value2));
    }

        void sort(Comparator<Pair> comp) {
            Collections.sort(pairs, comp);
        }

}

class Pair {

    int v1 = 0;
    int v2 = 0;

    public Pair(int val1, int val2) {
        v1 = val1;
        v2 = val2;
    }

}
