This paper investigates the downlink of massive multiple-input multiple-output (MIMO) systems that include a single cell Base Station (BS) equipped with large number of antennas serving multiple users. As the number of RF chains is getting large, the system model considered in this paper assumes a non negligible circuit power consumption. Hence, the aim of this work is to find the optimal balance between the power consumed by the RF chains and the transmitted power. First, assuming an equal power allocation among users, the optimal number of RF chains to be activated is analytically found. Then, for a given number of RF chains we derive analytically the optimal power allocation among users. Based on these analysis, we propose an iterative algorithm that computes jointly the optimal number of RF chains and the optimal power allocation vector. Simulations validate the analytical results and show the high performance provided by the proposed algorithm.