Blockade

No attempts yetTime limit1sMemory limit128 MB

Problem

The internet of Bytotia is a network of servers joined by one-way links. An attacker wants to cut off every route from server 1 to server nn. The attacker can plant a trap on any link, and when a trap goes off it destroys the single link it sits on. The attacker uses as few traps as possible while still guaranteeing that no message can travel from server 1 to server nn. Find that minimum number of traps.

Input

The first line contains two integers nn and mm (2n100002 \le n \le 10000): the number of servers and the number of links. Servers are numbered from 11 to nn. Each of the next mm lines contains two integers aa and bb (1a,bn1 \le a, b \le n, aba \ne b), describing a one-way link from server aa to server bb. There is at most one direct link between any two servers.

Output

Print a single integer: the minimum number of links that must be destroyed so that server 1 can no longer reach server nn.