#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <math.h>
#include <string.h>
#include <set>
#include <map>
#include <iostream>
#include <sstream>
#define MAXN 103
#define ll long long int
#define INF 0x3f3f3f3f
#define PI acos(-1)
#define MOD 1000000007LL
using namespace std;
int n, m, U, V, deg[MAXN], vis[MAXN];
bool dp[MAXN][MAXN];
bool can;
vector<vector<int> > g(MAXN);
void dfs(int u, int father, int begin){
if(can) return;
vis[u] = 1;
for(int i = 0; i < g[u].size(); i++){
int next = g[u][i];
if(next == begin && father != begin){
can = 1;
break;
}else{
if(!vis[next]){
dfs(next, u, begin);
}
}
}
}
int main(){
while(scanf("%d%d", &n, &m) && n > -1 && m > -1){
memset(deg, 0, sizeof(deg));
for(int i = 1; i <= n; i++){
g[i].clear();
vis[i] = 0;
}
for(int i = 0; i < m; i++){
scanf("%d%d", &U, &V);
g[U].push_back(V);
g[V].push_back(U);
deg[U]++;
deg[V]++;
}
bool go = true;
int ans = 0;
while(go){
go = false;
int idxA = -1, idxB = -1;
for(int j = 1; j <= n; j++){
if(deg[j] < 2){
idxA = j;
break;
}
}
for(int j = 1; j <= n; j++){
if(deg[j] < 2 && idxA != j){
idxB = j;
break;
}
}
if(idxA == -1 && idxB == -1){
break;
}
if(idxA != -1){
deg[idxA]++;
go = 1;
}
if(idxB != -1){
deg[idxB]++;
go = 1;
}else{
if(idxA != -1){
if(deg[idxA] < 2){
deg[idxA]++;
}
}
}
ans++;
}
vector<int> candidate;
if(ans == 0){
for(int i = 1; i <= n; i++){
memset(vis,0,sizeof(vis));
if(!vis[i]){
can = 0;
dfs(i, -1, i);
if(!can){
candidate.push_back(i);
}
}
}
}
printf("%d\n", ans + ((int)candidate.size()+1) / 2 );
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgoja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