#include<bits/stdc++.h>
using namespace std;
const int N=1145141;
int a[N],dfn[N],low[N],cut[N],he[N],ne[N],ve[N],br[N];
int m,n,tot,t;
void add(int x,int y)
{
ve[++tot]=y,ne[tot]=he[x],he[x]=tot;
}
void tar(int x,int dad){
dfn[x]=low[x]=++t;
for(int i=he[x];i;i=ne[i]){
int y=ve[i];
// cout<<y<<endl;
if(y==0)continue;
if(!dfn[y]){
tar(y,x);
low[x]=min(low[x],low[y]);
// cout<<x<<" "<<y<<" "<<dfn[x]<<" "<<low[y]<<endl;
if(dfn[x]<low[y]){
br[i]=br[i^1]=1;
// cout<<i<<endl;
}
}
else if(y!=dad){//if(x==2)cout<<low[x]<<endl;
low[x]=min(low[x],dfn[y]);
}
}
}
int main(){
cin>>n>>m;
if(m==0&&n==0)break;
memset(dfn,0,sizeof(dfn));
memset(low,0,sizeof(low));
memset(br,0,sizeof(br));
memset(he,0,sizeof(he));
memset(ne,0,sizeof(ne));
memset(ve,0,sizeof(ve));
int x,y;
for(int i=1;i<=m;i++){
cin>>x>>y;
add(x,y);
add(y,x);
}
for(int i=1;i<=n;i++){
if(!dfn[i]){
tar(i,i);
// cout<<i<<endl;
}
}
int ans=0;
for(int i=1;i<=n;i++){
for(int j=he[i];j;j=ne[j]){
if(br[j])ans++;
}
}
cout<<(ans+1)/2<<endl;
return 0;
}