#include<bits/stdc++.h>
using namespace std;
#define fr(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout)
#define IO ios::sync_with_stdio(0)
#define ll long long
inline void rd(int &x){
	x=0;
	bool f=0;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-')f=1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=x*10+ch-'0';
		ch=getchar();
	}
	if(f)x=-x;
}
const int N=5e5+10,M=1e9+7;
ll ans;
int n,m,u,v;
vector<int>v[N];
inline void add(const int &x,const int&y){
	v[x].push_back(y);
	v[y].push_back(x);
}
long long f(const int &x,const int)
int main(){
	//fr("barrack");
	rd(n),rd(m);
	for(int i=1;i<=m;++i){
		rd(u),rd(v);
		add(u,v);
	}
	cout<<f(1,1);
	return 0;
}
//I have come