import sys if sys.platform =='ios': import clipboard a=clipboard.get() a = a.split('\n') text = '\n'.join(a) with open('input_file.txt','w') as f: f.write(text) sys.stdin = open('input_file.txt') sys.setrecursionlimit(410000000) stdin = sys.stdin ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) ns = lambda: stdin.readline().strip() nm = lambda: map(int,input().split()) na_1 = lambda: list(map(lambda x:int(x)*(-1), stdin.readline().split())) na_2 = lambda: list(map(lambda x:int(x)-1, stdin.readline().split())) N,W = nm() dp = [[0]*(W+1) for i in range(N+1)] wv = [na()for i in range(N)] for i in range(1,N+1): for j in range(W+1): dp[i][j] = max(dp[i][j],dp[i-1][j]) if j >= wv[i-1][0]: dp[i][j] = max(dp[i][j],dp[i-1][j-wv[i-1][0]]+wv[i-1][1]) for x in range(1,W+1): print(dp[N][W]-dp[N][W-x]+1)