In this paper we study and improve one service used for Proximity Services and Device-to-Device (D2D) communications: D2D Direct Discovery. As defined in the Third Generation Partnership Project, for both in-coverage and out-of-coverage cases, resource pool parameters, including the transmission probability (in UE-Selected mode), are configured in advance. This means that they are independent of the network conditions and the number of users. Thus, we propose an adaptive algorithm which takes into account the available resources and the number of nearby users as they are being discovered, and adapts the transmission probability accordingly. This algorithm improves the overall performance of the discovery process. It reduces the time needed to complete the discovery within a group of UEs and makes it dynamic and adaptable to changing environments.