#include<iostream>
#include<algorithm>
using namespace std;

int n,l;
int a[100005];
int ans[100005];

int dfs(int x){
	if(ans[x]!=0)return ans[x];
	if(a[x]<a[x-1])ans[x]+=dfs(x-1);
	if(a[x]<a[x+1])ans[x]=max(ans[x],dfs(x+1));
	ans[x]+=l-a[x];
	return ans[x];
}

int main(){
	scanf("%d%d",&n,&l);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}

	int ret=0;
	for(int i=1;i<=n;i++){
		ret=max(ret,dfs(i));
	}

	printf("%d\n",ret);
}