An efficient algorithm for contextual bandits with knapsacks, and an extension to concave objectives