loop {
	n = gets.to_i
	break if n == 0
	m = gets.to_i

	friend = (0..n-1).map{|i| 1 << i}
	m.times {
		i, j = gets.split.map &:to_i
		i -= 1
		j -= 1
		friend[i] |= (1 << j)
		friend[j] |= (1 << i)
	}

	k = (1..n-1).select{|i|
		friend[0][i] == 1
	}.map{|i|
		friend[i]
	}.inject(0, :|).to_s(2).count(?1)-1

	p k < 0 ? 0 : k
}