import std.stdio;
import std.regex;

void main(){
	auto io = new IO();
	
	auto NX = io.rect()[0];
	size_t[] a = io.rect!size_t()[0];
	size_t[] res = a.dup;
	//auto need = new size_t[](NX[0]);
	
	size_t cap = a.min();
	
	foreach( i ; 0..a.length ){
		//size_t next = ( i+1 < a.length ) ? i+1 : 0 ;
		if( cap+NX[1] < res[i] ){
			a[i] = cast(uint)NX[1]+cap;
		}
	}
	//a.writeln();
	a.sum().writeln();
}


import std.stdio,std.conv,std.string;
import std.algorithm,std.array,std.math;
import std.bigint;

immutable PRIME = 1_000_000_007;
immutable alphaB = "abcdefghijklmnopqrstuvwxyz";
immutable alphaU = "ABCDRFGHIJKLMNOPQRSTUVWXYZ";

T min( T )( in T[] args ){
	T ret = T.max;
	foreach( x ; args )
		ret = ( x < ret ) ? x : ret ;
	return ret;
}

class IO
{
	T[] line( T = real , string token = " " )( size_t m = 1 ){
		T[] arr = [];
		foreach( i ; 0..m ){
			arr ~= this.read!T();
		}
		return arr;
	}
	T[][] rect( T = real , string token = " " )( size_t m = 1 ){
		T[][] arr = new T[][](m);
		foreach( i ; 0..m ){
			arr[i] = this.read!T(token);
		}
		return arr;
	}
	private T[] read( T = size_t )( string token = " " ){
		T[] arr;
		foreach( elm ; readln().chomp().split(token) ){
			arr ~= elm.to!T();
		}
		return arr;
	}
	void swap( T )( ref T x , ref T y ){
		x = x^y;
		y = x^y;
		x = x^y;
	}
}