import std.stdio,std.string,std.conv,std.algorithm,std.array;

void main()
{
    bool[501][501] M;
    while(true)
    {
        int n=readln.chomp.to!int;
        int m=readln.chomp.to!int

        if(n==0&&m==0)break;

        foreach(unused;0..m)
        {
            auto input=readln.split.map!(to!int);
            M[input[0]][input[1]]=true;
            M[input[1]][input[0]]=true;
        }

        int[int] num;

        foreach(i; 2..n+1)
        {
            if(M[1][i])
            {
                num[i]=0;

                foreach(j; 2..n+1)
                {
                    if(M[i][j])
                    {
                        num[j]=0;
                    }
                }
            }
        }

        num.length.writeln;

        foreach(i; 1..n+1) foreach(j; 1..n+1) M[i][j]=false;
    }
}