Hide and Seek

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

Sven the Polar Bear (the mascot of the various Swedish national teams in science sports) plays hide and seek with Gloria the Hippo (the mascot from Madagascar). The game is played in a network of mm caves, numbered between 00 and m1m - 1. The caves are connected by m1m - 1 tunnels (each between two distinct caves), such that there is a path between any pair of caves.

Each round starts with Gloria hiding in one of the caves (except cave 00) with uniform probability. Sven, starting in cave 00, then has nn seconds to find Gloria. Each tunnel takes some number of seconds for Sven to traverse depending on the length of the tunnel, and can be traversed in both directions.

Sven likes to win, so he wants to choose his movements in such a way that he maximizes the probability of finding Gloria before the nn seconds are up. How many caves does Sven have time to visit?

입력

The input consists of:

  • one line with the integers mm and nn (2m1002 \le m \le 100, 1n3001 \le n \le 300), the number of caves in the network and the number of seconds Sven has to find Gloria.
  • m1m - 1 lines with three integers uu, vv and tt (0uv<m0 \le u \not= v < m, 1t3001 \le t \le 300), the two endpoints of a tunnel and the time it takes to traverse the tunnel, in seconds.

출력

Output the maximum number of caves Sven can visit, excluding the cave he starts in.