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