// Arup Guha
// 2/19/2024
// Solution to 2023 UCF HS Online D1 Problem: What's Zupp?

import java.util.*;

public class zupp {

	public static void main(String[] args) {
	
		Scanner stdin = new Scanner(System.in);
		int n = stdin.nextInt();
		long cost = stdin.nextLong();
		
		// Store locations.
		long[] locs = new long[n];
		for (int i=0; i<n; i++)
			locs[i] = stdin.nextLong();

		// dp[i] is best cost to get all the way up to location i for both people.
		long[] dp = new long[n];
		dp[0] = cost;
		
		// Figuring out best cost to get to index i.
		for (int i=1; i<n; i++) {
			
			// Start and i --> 0 --> switch --> i
			dp[i] = 2*(locs[i]-locs[0])+cost;
			
			// j is the location we are building off of.
			for (int j=0; j<i; j++) { 
			
				// Normally, we walk from j to i, switch, then walk back from
				// i to j+1, and then back from j+1 to i.
				long add = locs[i]-locs[j] + cost + 2*(locs[i]-locs[j+1]);
				
				// Only if we are at the end, we don't have to the walk back to
				// location i because both people got all the deals, so subtract
				// This bit out.
				if (i == n-1) add -= (locs[i]-locs[j+1]);
				
				// Update best cost to i if necessary.
				dp[i] = Math.min(dp[i], dp[j]+add);
			}		
		}
		
		// Ta da!
		System.out.println(dp[n-1]);
	}
}