Device-to-device (D2D) communication is a crucial technique for various proximity services. In addition to high-rate transmission and high spectral efficiency, a minimum data rate is increasingly required in various applications, such as gaming and real-time audio/video transmission. In this paper, we consider D2D underlaid cellular networks and aim to minimize the total channel bandwidth while every user equipment (UE) needs to achieve a pre-determined target data rate. The optimization problem is jointly involved with matching a cellular UE (CU) to a D2D UE (DU), and with channel assignment and power control. The optimization problem is decoupled into two suboptimization problems to solve power control and channel assignment problems separately. For arbitrary matching of CU, DU, and channel, the minimum channel bandwidth of the shared channel is derived based on signal-to-interference-plus-noise ratio (SINR)-based power control. The channel assignment is a three-dimensional (3-D) integer programming problem (IPP) with a triple (CU, DU, channel). We apply Lagrangian relaxation, and then decompose the 3-D IPP into two two-dimensional (2-D) linear programming problems (LPPs). From intensive numerical results, the proposed resource allocation scheme outperforms the random selection and greedy schemes in terms of average channel bandwidth. We investigate the impact of various parameters, such as maximum D2D distance and the number of channels.