n, l = map(int, input().split()) assert 3 <= n <= 5*10**5 assert n <= l <= 10**12 t = [int(i) for i in input().split()] assert 0 <= min(t) and max(t) <= l-1 for i in range(n-1): assert t[i] < t[i+1]