import sys import os import inspect input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) inf = 10 ** 18 if os.getenv("TKTKLOCAL", False): def debug(*arg, sep=" ", end="\n"): print(*arg, sep=sep, end=end, file=sys.stderr) def debug_indent(*arg, sep=" ", end="\n", indent=" "): frame = inspect.currentframe().f_back par_func = inspect.getframeinfo(frame).function if par_func == "": debug(*arg, sep=sep, end=end) return frame_stack = inspect.stack() if len(frame_stack) > 30: return depth = sum(f.function == par_func for f in frame_stack) debug(indent * (depth - 1), end="") debug(*arg, sep=sep, end=end) else: def debug(*arg, **kwarg): pass def debug_indent(*arg, **kwarg): pass def main(): N, W = map(int, input().split()) dp = [-inf] * (W + 1) dp[0] = 0 for _ in range(N): a, b = map(int, input().split()) for i in range(a, W+1)[::-1]: dp[i] = max(dp[i], dp[i-a] + b) debug(dp) for i in range(1, W+1): dp[i] = max(dp[i], dp[i-1]) wmax = dp[W] + 1 for i in range(1, W+1): print(wmax - dp[W - i]) main()