One-Way Roads

Orient every edge of an undirected graph so that the maximum number of edges entering any vertex is as small as possible.

Medium7GraphGreedyNo attempts yetTime limit2sMemory limit512 MB

Problem

In the country of Via, roads connect the cities and every road can be driven in both directions. The lanes are not separated, so accidents are common: drivers look at their smartphones while driving and hit the oncoming traffic. The politicians of Via decided to turn every road into a one-way road. Each existing road keeps exactly one of its two possible directions.

The mayors do not want too many one-way roads leading into their cities, because that causes traffic jams inside a city. Find the smallest integer dd such that there is an assignment of directions in which every city has at most dd one-way roads leading into it.

Input

The first line contains an integer nn (1n5001 \le n \le 500), the number of cities. The cities are labeled from 1 to nn.

The second line contains an integer mm (0m25000 \le m \le 2500), the number of bidirectional roads.

Each of the next mm lines describes one road with two integers aa and bb (1a,bn1 \le a, b \le n, aba \ne b), meaning that there is a road between city aa and city bb.

There is at most one road between any two cities.

Output

Print the minimum dd on one line.