import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.HashSet; import java.util.NoSuchElementException; public class Main { public static void main(String[] args) throws FileNotFoundException { long t = System.currentTimeMillis(); new Main().run(); System.err.println(System.currentTimeMillis() - t); } void run() { FastScanner sc = new FastScanner(); HashSet set=new HashSet<>(); int N=sc.nextInt(); int L=sc.nextInt(); int[] X=new int[N]; int[] W=new int[N]; int[] T=new int[N]; int curT=0; for(int i=0;i0?(X[i-1]+W[i-1]):0); if(curT%(2*T[i])>=T[i])curT+=2*T[i]-curT%(2*T[i]); if(T[i]-curT%(2*T[i])