Ming is a scientist who needs to attend an important international scientific conference to present his latest research. He needs to bring some research materials with him, but he has limited space in his suitcase. These research materials include experimental equipment, literature, experimental samples, etc., each of which occupies a different space and has a different value.
Ming’s luggage space is N. Ask Ming how he should choose to carry the most valuable research materials. Each research material can only be chosen once, and there are only two choices: choose or not choose, no cutting.
Input:
1 2 3
The first row contains two positive integers, thefirstinteger, M, representing the type of research material andthesecond positive integer, N, representing Ming's luggage space. The second row contains M positive integers representing thespace occupied by each type of research material. The third row contains M positive integers representing the value of each research material.
Output:
1
Output aninteger representing the maximum valueof research material that Ming can carry.