ACT NW 2018 5, 1: find the least amount of bins needed to hold all items

This is a problem of computer programming competition from last year. The problems were sent home with the competitors, so I would consider them "released."

The problem is: "You want to choose the minimum number of shelves for all your book collections, so that each book collection is not divided between each shelf." Each shelf is at the same price, and the collections and the shelves can have different sizes. "To emphasize, the books can not be divided on separate shelves if they are in the same collection. There may be several collections on the same shelf.

Input example (first line: size of each book shelf, second line: size of each book collection):

150 150 300 150 150

70 76 99 75 105

Expected results (number of shelves needed):


This was given at a beginner level competition. So I suppose that they want the competitors to make some sort of brute-force solution to that, like recursing through all the different possible selections (and then another recursion to understand how to put the books on the shelves properly) up to a minimal solution is found. Is there another algorithm that can be used for that which is not brute force?