N,W=map(int,input().split()) WV=[list(map(int,input().split())) for i in range(N)] DP=[0]*(W+1) for w,v in WV: for i in range(W,-1,-1): if i+w<=W and DP[i+w]