#include<iostream>
using namespace std;

#define N 100000
#define INFLL 1000000000007

#define max(a,b) (a>b?a:b)
#define min(a,b) (a>b?b:a)

typedef long long ll;

ll n, l, s[N];
ll solve(int i, int d) {
  if(d==0) {
    if(s[i-1]<s[i] || i==0) return l-s[i];
    return (l-s[i]) + solve(i-1, 0);
  }else {
    if(s[i]>s[i+1] || i==n-1) return l-s[i];
    return (l-s[i]) + solve(i+1, 1);
  }
}

int main() {
  cin >> n >> l;
  ll ans = 0;
  for(int i=0; i<n; ++i) cin >> s[i];
  for(int i=0; i<n; ++i) {
    if((i==0 || s[i-1]>=s[i]) && (i==n-1 || s[i]<=s[i+1])) {
      ll l = solve(i, 0), r = solve(i, 1);
      ans = max(ans, max(l, r));
    }
  }
  cout << ans << endl;
  return 0;
}