import sys #sys.setrecursionlimit(500000) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def TI(): return tuple(map(int,sys.stdin.readline().rstrip().split())) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip()) #for i, pi in enumerate(p): from collections import defaultdict,deque import bisect import itertools dic = defaultdict(int) d = deque() YN = ['No','Yes'] N,W = MI() dp = [-1]*(W+1) #for _ in range(N)] dp[0] = 0 for _ in range(N): w,v = MI() for i in range(W-w,-1,-1): if dp[i] == -1: continue dp[i+w] = max(dp[i]+v,dp[i+w]) #https://aotamasaki.hatenablog.com/entry/meguru_bisect def is_ok(arg,x): return dp[W] < dp[W-x]+arg # return #満たすべき条件a 1): mid = (ok + ng) // 2 if is_ok(mid,x): ok = mid else: ng = mid return ok for x in range(1,W+1): print(meguru_bisect(0, 10**10,x))