N, W = map(int, input().split()) dp = [[0 for _ in range(W+1)] for _ in range(N+1)] for i in range(N): w, v = map(int, input().split()) for weight in range(W+1): if weight + w <= W : dp[i+1][weight + w] = max(dp[i+1][weight + w], dp[i][weight] + v) dp[i+1][weight] = max(dp[i+1][weight], dp[i][weight]) t = max(dp[N]) + 1 for x in range(1, W+1): print(t - dp[N][W-x])