#include <cstdio>
#include <cstring>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;

typedef long long int64;

int n, l;
int a[100000];

int dp[100000];

int calc(int pos)
{
	int wait = 0;
	
	if(dp[pos] != 0)
		return dp[pos];
	
	if(0 < pos && a[pos] < a[pos - 1])
		wait = max(wait, calc(pos - 1));
	if(pos < n - 1 && a[pos] < a[pos + 1])
		wait = max(wait, calc(pos + 1));
		
	return dp[pos] = wait + l - a[pos];
}
	
int main()
{
	scanf("%d%d", &n, &l);
	for(int i = 0; i < n; ++i)
		scanf("%d", a + i);
		
	int ans = 0;
	
	for(int i = 0; i < n; ++i)
		ans = max(ans, calc(i));
		
	printf("%d\n", ans);
	
	return 0;
}