#include<iostream>
#include<algorithm>
using namespace std;
int n,a[100000+2],l,memo[100000+2];

int solve(int x){
	if(memo[x]!=-1)return memo[x];
	int ret=0;
	if(a[x-1]>a[x])ret=solve(x-1);
	if(a[x+1]>a[x])ret=max(ret,solve(x+1));
	ret+=l-a[x];
	memo[x]=ret;
	return ret;
}

int main(){
	for(int i=0;i<100002;i++){a[i]=0; memo[i]=-1;}
	scanf("%d%d",&n,&l);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	int ans=0;
	for(int i=1;i<=n;i++)ans=max(ans,solve(i));
	printf("%d\n",ans);
}