n, m = gets.chomp.split.map(&:to_i)
friends = Array.new(n).map{Array.new}
m.times do
    a, b = gets.chomp.split.map(&:to_i)
    friends[a-1] << b-1
    friends[b-1] << a-1
end
ans = 0
n.times do |i|
    friends[i] = friends[i].uniq
end

friends.each do |friend_numbers|
    arr = friend_numbers
    friend_numbers.each do |idx|
        arr += friends[idx]
    end
    tmp = arr.uniq.size
    ans = ans < tmp ? tmp : ans
end

puts ans