/*
#include<stdio.h>
int stack[50001];
int top=-1;
void push(int data)
{
top++;
stack[top]=data;
}
int pop()
{
return stack[top--];
}
int main()
{
char str[101],str1[101];
int i,sum,a,b,num,c=0,x,y;
scanf("%s %s",str,str1);
a=strlen(str)-1;
b=strlen(str1)-1;
while(a>=0||b>=0)
{
if(a==-1) x=0;
else x=str[a--]-'0';
if(b==-1) y=0;
else y=str1[b--]-'0';
num=x+y+c;
push(num%10);
c=num/10;
}
if(c!=0) push(c);
while(top!=-1)
{
printf("%d",pop());
}
}
#include<stdio.h>
int stack[50001];
int top=-1;
void push(int data)
{
top++;
stack[top]=data;
}
int pop()
{
return stack[top--];
}
int main()
{
char str[201];
int i,a,b,num=0;
gets(str);
for(i=0;str[i]!=NULL;i++)
{
if(48<=str[i]&&str[i]<=57)
{
num=num*10+str[i]-'0';
if(str[i+1]==' ')
{
push(num);
num=0;
}
}
else if(str[i]=='+')
{
a=pop();
b=pop();
push(b+a);
}
else if(str[i]=='-')
{
a=pop();
b=pop();
push(b-a);
}
else if(str[i]=='*')
{
a=pop();
b=pop();
push(b*a);
}
}
printf("%d",pop());
return 0;
}
*/
/*
#include <stdio.h>
#define SIZE 50
int queue[SIZE];
int front=-1,rear=-1;
void enqueue(int data)
{
//rear
rear++;
queue[rear]=data;
}
int dequeue()
{
//front : 데이터가 마지막으로 나간 위치
front++;
return queue[front];
}
int main()
{
}
*/
#include<stdio.h>
int arr[101][101]={},a[101]={},n;
void dfs(int node)
{
for(int i=1;i<=n;i++)
{
if(arr[node][i]==1 && a[i]==0)
{
a[i]=1;
dfs(i);
}
}
}
int main()
{
int b,c=0,x,y;
scanf("%d %d",&n,&b);
for(i=1;i<=b;i++)
{
scanf("%d %d",&x,&y);
arr[x][y]=arr[y][x]=1;
}
dfs(1);
for(i=2;i<=n;i++)
{
c+=a[i];
}
printf("%d",c);
}