N,W = map(int,input().split()) A = [0]+[list(map(int,input().split())) for _ in range(N)] dp = [[0 for _ in range(W+1)] for _ in range(N+1)] for j in range(1,W+1): dp[1][j] = A[1][1] if A[1][0]<=j else 0 for i in range(2,N+1): for j in range(1,W+1): dp[i][j] = dp[i-1][j] if j>=A[i][0]: dp[i][j] = max(dp[i][j],dp[i-1][j-A[i][0]]+A[i][1]) for x in range(1,W+1): print(dp[N][W]+1-dp[N][W-x])