In this paper, we investigate a cell-free massive multiple-input multiple-output (CF-mMIMO) system with a reconfigurable intelligent surface (RIS) carried by an unmanned aerial vehicle (UAV), called the UAV-RIS. Compared with the RIS located on the ground, the UAV-RIS has a wider coverage that can reflect all signals from access points (APs) and user equipment (UE). By correlating the UAV location with the Rician K-factor, we derive a closed-form approximation of the UE achievable downlink rate. Based on this, we obtain the optimal UAV location and RIS phase shift that can maximize the UE sum rate through an alternating optimization method. Simulation results have verified the accuracy of the derived approximation and shown that the UE sum rate can be significantly improved with the obtained optimal UAV location and RIS phase shift. Moreover, we find that with a uniform UE distribution, the UAV-RIS should fly to the center of the system, while with an uneven UE distribution, the UAV-RIS should fly above the area where UEs are gathered. In addition, we also design the best trajectory for the UAV-RIS to fly from its initial location to the optimal destination while maintaining the maximum UE sum rate per time slot during the flight.