import numpy as np,scipy as sc M=np.loadtxt(open(0),"q") N,W=M[0];v,w=M[1:].T print(-int(sc.optimize.linprog(-v,[w.T],W,integrality=1).fun))