input = readlines()
n, m = input.shift.chomp.split("\s").map{|x| x.to_i}

groups = []
in_group = {}
input.each do |l|
  a, b = l.chomp.split("\s").map{|x| x.to_i}
  if in_group[a].nil? && !in_group[b].nil?
    in_group[a] = in_group[b]
    groups[in_group[b]].push(a) unless groups[in_group[b]].include?(a)
    next
  end
  if !in_group[a].nil? && in_group[b].nil?
    in_group[b] = in_group[a]
    groups[in_group[a]].push(b) unless groups[in_group[a]].include?(b)
    next
  end
  if !in_group[a].nil? && !in_group[b].nil?
    next if in_group[a] == in_group[b]
    groups[in_group[b]].each do |member|
      groups[in_group[a]].push(member) unless groups[in_group[a]].include?(member)
    end
    groups[in_group[b]] = []
    in_group[b] = in_group[a]
    next
  end
  groups.push([a, b])
  in_group[a] = groups.length - 1
  in_group[b] = groups.length - 1
end

cnt = 0
groups.each do |g|
  cnt = g.length if cnt < g.length
end

cnt = 1 if cnt == 0

puts cnt

