#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define sar(a,n) {cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl;}

using namespace std;

template<typename S,typename T>auto&operator<<(ostream&o,pair<S,T>p){return o<<"{"<<p.fi<<","<<p.se<<"}";}
template<typename T>auto&operator<<(ostream&o,set<T>s){for(auto&e:s)o<<e<<" ";return o;}
template<typename S,typename T,typename U>
auto&operator<<(ostream&o,priority_queue<S,T,U>q){while(!q.empty())o<<q.top()<<" ",q.pop();return o;}
template<typename K,typename T>auto&operator<<(ostream&o,map<K,T>&m){for(auto&e:m)o<<e<<" ";return o;}
template<typename T>auto&operator<<(ostream&o,vector<T>v){for(auto&e:v)o<<e<<" ";return o;}
void ashow(){cout<<endl;}template<typename T,typename...A>void ashow(T t,A...a){cout<<t<<" ";ashow(a...);}
template<typename S,typename T,typename U>
struct TRI{S fi;T se;U th;TRI(){}TRI(S f,T s,U t):fi(f),se(s),th(t){}
bool operator<(const TRI&_)const{return(fi==_.fi)?((se==_.se)?(th<_.th):(se<_.se)):(fi<_.fi);}};
template<typename S,typename T,typename U>
auto&operator<<(ostream&o,TRI<S,T,U>&t){return o<<"{"<<t.fi<<","<<t.se<<","<<t.th<<"}";}

typedef pair<int, int> P;
typedef pair<ll, ll> pll;
typedef TRI<int, int, int> tri;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef vector<string> vs;

const int MAX_N = 100005;

class FindingAllCycles {
private:
    struct node {
        int prev, next, to;
        node(const int _prev, const int _next, const int _to)
            : prev(_prev), next(_next), to(_to){}
    };
    const int V;
    vector<vector<node> > G;
    vector<stack<int> > block_stack;
    stack<int> st;
    bool *fix, *blocked, *used;
    bool enumerate;
    void erase_edge(const int u, const int id){
        G[u][G[u][id].next].prev = G[u][id].prev;
        G[u][G[u][id].prev].next = G[u][id].next;
    }
    void scc_dfs(const int u, int& tm, int& cnt,
            vector<int>& ord, vector<int>& low, vector<int>& cmp, stack<int>& st){
        ord[u] = low[u] = tm++, st.push(u);
        for(int id = G[u][0].next; id != 0; id = G[u][id].next){
            const int v = G[u][id].to;
            if(ord[v] < 0){
                scc_dfs(v, tm, cnt, ord, low, cmp, st);
                low[u] = min(low[u], low[v]);
            }else if(cmp[v] < 0){
                low[u] = min(low[u], ord[v]);
            }
            if(cmp[v] >= 0) erase_edge(u, id);
        }
        if(ord[u] == low[u]){
            while(true){
                const int v = st.top();
                st.pop(), cmp[v] = cnt;
                if(v == u) break;
            }
            ++cnt;
        }
    }
    void scc(){
        vector<int> ord(V, -1), low(V), cmp(V, -1);
        stack<int> st;
        int tm = 0, cnt = 0;
        for(int i = 0; i < V; ++i){
            if(ord[i] < 0) scc_dfs(i, tm, cnt, ord, low, cmp, st);
        }
    }
    void unblock(const int u){
        blocked[u] = false;
        while(!block_stack[u].empty()){
            const int v = block_stack[u].top();
            block_stack[u].pop();
            if(blocked[v]) unblock(v);
        }
    }
    bool dfs(const int u, const int s, vector<int>& path, vector<int>& ver_list){
        bool flag = false;
        path.push_back(u);
        blocked[u] = true;
        if(!used[u]) used[u] = true, ver_list.push_back(u);
        for(int id = G[u][0].next; id != 0; id = G[u][id].next){
            const int v = G[u][id].to;
            if(fix[v]){
                erase_edge(u, id);
                continue;
            }
            if(v == s){
                if(enumerate) ans.push_back(path);
                ++count, flag = true;
            }else if(!blocked[v]){
                if(dfs(v, s, path, ver_list)) flag = true;
            }
        }
        if(flag) unblock(u);
        else{
            for(int id = G[u][0].next; id != 0; id = G[u][id].next){
                block_stack[G[u][id].to].push(u);
            }
        }
        path.pop_back();
        return flag;
    }

public:
    vector<vector<int> > ans;
    int count;
    FindingAllCycles(const int node_size)
        : V(node_size), G(V, vector<node>{{0, 0, -1}}), block_stack(V),
            fix(new bool[V]()), blocked(new bool[V]()), used(new bool[V]()), count(0){}
    ~FindingAllCycles(){
        delete[] fix, delete[] blocked, delete[] used;
    }
    void add_edge(const int u, const int v){
        if(u == v){
            ans.push_back({u});
            return;
        }
        G[u][0].prev = G[u].back().next = (int)G[u].size();
        G[u].push_back((node){(int)G[u].size() - 1, 0, v});
    }
    int solve(bool _enumerate=true){
        scc();
        enumerate = _enumerate;
        for(int i = 0; i < V; ++i){
            vector<int> path, ver_list;
            dfs(i, i, path, ver_list);
            fix[i] = true;
            for(int j : ver_list){
                used[j] = blocked[j] = false, block_stack[j] = stack<int>();
            }
        }
        return count;
    }
};

template<typename T> class segtree {
private:
    int n,sz;
    vector<pair<T, int> > node;
public:
    void resize(vector<T>& v){
        sz = (int)v.size();
        n = 1;
        while(n < sz){
            n *= 2;
        }
        node.resize(2*n);
        for(int i = 0; i < sz; i++){
            node[i+n] = make_pair(v[i], i);
        }
        for(int i=n-1; i>=1; i--){
            node[i] = min(node[2*i], node[2*i+1]);
        }
    }
    void update(int k, T a)
    {
    	node[k+=n] = make_pair(a, k);
    	while(k>>=1){
            node[k] = min(node[2*k], node[2*k+1]);
    	}
    }
    pair<T, int> query(int a,int b)
    {
        pair<T, int> res1 = make_pair(numeric_limits<T>::max(), -1);
        pair<T, int> res2 = make_pair(numeric_limits<T>::max(), -1);
        a += n, b += n;
        while(a != b){
            if(a % 2) res1 = min(res1, node[a++]);
            if(b % 2) res2 = min(res2, node[--b]);
            a >>= 1, b >>= 1;
        }
        return min(res1, res2);
    }
};

struct edge {
    int from, to, id;
    edge(const int _from, const int _to, const int _id)
        : from(_from), to(_to), id(_id){}
};

class LCA{
public:
    int V;
    vector<vector<int> > G;
    vector<int> ord,depth,id;
    segtree<int> st;
    LCA(int node_size) : V(node_size), G(V), depth(V), id(V, -1){}
    void add_edge(int from,int to){
        G[from].push_back(to),G[to].push_back(from);
    }
    void dfs(int u,int p,int k){
        id[u] = (int)ord.size();
        ord.push_back(u);
        depth[u] = k;
        for(int v : G[u]){
            if(v != p){
                dfs(v,u,k+1);
                ord.push_back(u);
            }
        }
    }
    void build(){
        ord.reserve(2*V-2);
        for(int i = 0; i < V; i++){
            if(id[i] < 0){
                dfs(i,-1,0);
            }
        }
        vector<int> stvec(2*V-2);
    	for(int i = 0; i < 2*V-2; i++){
    		stvec[i] = depth[ord[i]];
    	}
        st.resize(stvec);
    }
    int solve(int u,int v){
        return ord[st.query(min(id[u],id[v]),max(id[u],id[v])+1).second];
    }
    int dist(int u,int v){
        int lca = solve(u,v);
        return depth[u] + depth[v] - 2*depth[lca];
    }
    pair<int, int> construct_virtual_tree(vector<int>& ver_list, unordered_map<int, int>& mapping);
};

vector<pair<int, int> > es;

pair<int, int> LCA::construct_virtual_tree(vector<int>& ver_list, unordered_map<int, int>& mapping){
    const int n = (int)ver_list.size();
    sort(ver_list.begin(), ver_list.end(), [&](const int a, const int b){
        return id[a] < id[b];
    });
    stack<int> st;
    st.push(ver_list[0]), mapping[ver_list[0]] = 0;
    int id = n;
    for(int i = 0; i < n-1; ++i){
        const int u = solve(ver_list[i], ver_list[i+1]);
        if(u != ver_list[i]){
            int mapped_ver = mapping[st.top()];
            while(true){
                st.pop();
                if(st.empty() || depth[u] >= depth[st.top()]) break;
                const int tmp = mapping[st.top()];
                es.push_back({tmp, mapped_ver});
                mapped_ver = tmp; 
            }
            if(st.empty() || st.top() != u){
                st.push(u), ver_list.push_back(u);
                es.push_back({id, mapped_ver});
                mapping[u] = id++;
            }else{
                es.push_back({mapping[u], mapped_ver});
            }
        }
        st.push(ver_list[i+1]), mapping[ver_list[i+1]] = i+1;
    }
    int mapped_ver = ((st.size() > 1) ? mapping[st.top()] : -1);
    while(st.size() > 1){
        st.pop();
        const int tmp = mapping[st.top()];
        es.push_back({tmp, mapped_ver});
        mapped_ver = tmp;
    }
    return {id, es.size()};
}

vector<int> G[MAX_N];
int visit[MAX_N];
vector<P> ot;
vector<int> ver_list;

void dfs(const int u, const int p, LCA& lca){
    visit[u] = 1;
    for(const int v : G[u]){
        if(v == p) continue;
        if(visit[v] == 0){
            lca.add_edge(u, v);
            dfs(v, u, lca);
        }else if(visit[v] == 1){
            ver_list.push_back(u), ver_list.push_back(v);
            ot.push_back({u, v});
        }
    }
    visit[u] = 2;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    rep(i, m){
        int a, b;
        cin >> a >> b;
        --a, --b;
        G[a].pb(b), G[b].pb(a);
    }
    if(m == n-1){
        cout << "0\n";
        return 0;
    }
    LCA lca(n);
    dfs(0, -1, lca);
    lca.build();
    zip(ver_list);
    unordered_map<int, int> mp;
    auto res = lca.construct_virtual_tree(ver_list, mp);
    int N = res.first, M = res.second;
    FindingAllCycles fac(N);
    for(const P& e : es){
        fac.add_edge(e.first, e.second), fac.add_edge(e.second, e.first);
    }
    for(const P& p : ot){
        const int u = mp[p.first], v = mp[p.second];
        fac.add_edge(u, v), fac.add_edge(v, u);
        ++M;
    }
    cout << (fac.solve(false) - M) / 2 << "\n";
    return 0;
}
