We design adaptive resource allocation schemes for cognitive radios so that the sum-rate of secondary users is optimized while the damage (interference) to the primary users is keep under control. Secondary users transmit orthogonally and adhere to limits on: a) the long-term interfering power at each primary receiver and b) the long-term capacity loss inflicted to each primary receiver. We first analyze the single antenna case and then consider that the secondary users implement adaptive beamforming. The focus of the paper is on scenarios where users can implement only a finite number of power levels and beamforming vectors. Although b) renders the resultant optimization problem non-convex, it holds that it has zero duality gap and that, due to the favorable structure in the dual domain, it can be solved in polynomial time. Specifically, it holds that the computational complexity required to obtain the optimum resource allocation for a given fading realization is proportional to the number of: secondary users, primary users (channels), power levels, and beamforming vectors.