Hamilton-Jacobi-Bellman equation for a time-optimal control problem in the space of probability measures