#include <stdio.h>
#include <string.h>
#define black 1
#define white -1
int already[];
int in[];
int gr[][];
int n;
int v[];
int pf,pe; int dfs(int a,int color){
v[a]=color;
int i;
int sign;
for(i=;i<=n;++i){
if(i==a) continue;
if(gr[a][i]&&v[i]==){
if((sign=dfs(i,-color))==-) return -;
}else if(gr[a][i]&&v[i]==color){
return -;
}
}
return ;
}
int judge(){
int i;
int sign;
memset(v,,sizeof(v));
for(i=;i<=n;++i){
if(==v[i]){
if((sign=dfs(i,black))==-) return -;
}
}
return ;
} int find(int a){
int i;
for(i=;i<=n;++i){
if(v[i]==white&&gr[a][i]&&!in[i]){
in[i]=;
if(already[i]==||find(already[i])){
already[i]=a;
return ;
}
}
}
return ;
}
int main(){
int m;
int i,j;
int res;
while(~scanf("%d%d",&n,&m)){
res=;
memset(gr,,sizeof(gr));
while(m--){
scanf("%d%d",&i,&j);
gr[i][j]=;
gr[j][i]=;
}
if(judge()==-){
printf("No\n");
continue;
} memset(already,,sizeof(already));
for(i=;i<=n;++i){
memset(in,,sizeof(in));
if(v[i]==black)
if(find(i))
res++;
}
printf("%d\n",res);
}
return ;
}