As you know, poor XMM has been dreaming to go to Happyvalley for a long time. The good news is that today her mom finally agreed to take her there this weekend!
In order to make her journey in Happyvalley happier, XMM bought a map of Happyvalley to design a good plan. Happyvalley has N scenic spots which are connected by roads. XMM found that there is exactly one path between each two spots.
XMM can start her journey from arbitrary scenic spot. Several minutes are required for her to walk from one end to the other end on each road. Also, she would spend X minutes for each spot she visit. However, many reasons, such as XMM’s mood, weather condition and so on, may alter X. So there are many possible values of X.
Mom told XMM that she would stay in Happyvalley for only P minutes. Given the information of Happyvalley and the total time P minutes, also, with the time X XMM guesses she would spend in each spot, can you tell XMM the maximum number of spots she may visit? Note that each spot should be counted only once.