#include <cstdio>
#include <algorithm>
using namespace std;
int n;
int l;
int a[111111];

int dp[111111];
int solve(int i){
  if(dp[i]) return dp[i];
  int ret = 0;
  if(a[i-1] > a[i])ret = solve(i-1);
  if(a[i+1] > a[i])ret = max(ret,solve(i+1));
  return dp[i] = ret + l - a[i];
}

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