import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; public class Main { public static void main(String[] args) { new Main().run(); } void run() { Scanner sc=new Scanner(System.in); int N=sc.nextInt(); int M=sc.nextInt(); int[][] a=new int[2][N]; a[0][0]=M; for (int i=1;iv[0]).thenComparing(v->v[1])); int need=0; for (int j=0;j<(i+1)/2;++j) { need+=x[j][0]+1; a[i%2][x[j][1]]=x[j][0]+1; } if (need<=M) { a[i%2][i]=M-need; } else { a[i%2]=Arrays.copyOf(a[(i-1)%2], N); a[i%2][i]=-1; } } for (int i=0;i