#include <cmath>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <iomanip>
#include <cstdio>
#include <cctype>
#include <queue>
#include <complex>
#include <climits>

typedef long long ll;

using namespace std;

int a[100010] = {0};

int main(void){
	int N, L, num = 0;
	ll sum = 0, Max = 0;
	cin >> N >> L;

	cin >> a[1];
	for(int i=1; i<=N; ++i){
		if(i < N) cin >> a[i+1];
		num++;
		sum += a[i];
		if((a[i]-a[i-1] < 0 && a[i+1]-a[i] >= 0) || (a[i]-a[i-1] > 0 && a[i+1]-a[i] <= 0) || i == N){
			Max = max(Max, (ll)num*L - sum);
			num = 1;
			sum = a[i];
		}
	}

	cout << Max << endl;

	return 0;
}