from collections import deque,defaultdict N,W=map(int,input().split()) pre=[list(map(int,input().split())) for _ in range(N)] dp=dict() #dp[i][j]:i番目の品物までで、重さjになる組み合わせの中での勝ちの総和の最大値 #配る d=deque() d.append(0) dp[0]=0 A=W+5 while d: n=d.popleft() i,j=divmod(n,A) if i==N: break now=dp.pop(n) if (i+1)*A+j not in dp: dp[(i+1)*A+j]=0 d.append((i+1)*A+j) dp[(i+1)*A+j]=max(now,dp[(i+1)*A+j]) w,v=pre[i] if j+w<=W: if (i+1)*A+j+w not in dp: dp[(i+1)*A+j+w]=0 d.append((i+1)*A+j+w) dp[(i+1)*A+j+w]=max(now+v,dp[(i+1)*A+j+w]) ans=[] for j in range(W+1): if j==0: ans.append(0) else: if N*A+j not in dp: ans.append(ans[-1]) else: ans.append(max(dp[N*A+j],ans[-1])) ans_now=ans[W] for X in range(1,W+1): print(ans_now-(ans[W-X])+1)