#include <bits/stdc++.h>
#define forn(i,s,t) for(int i=(s); i<=(t); ++i)
#define form(i,s,t) for(int i=(s); i>=(t); --i)
#define rep(i,s,t) for(int i=(s); i<(t); ++i)
typedef long long i64;
using namespace std;
const int Mod = 1e9 + 7;
struct mint {
	int r;
	mint() {}
	mint(int _r) : r(_r) {}
	inline friend mint operator + (const mint& A, const mint& B) {
		return mint((A.r + B.r >= Mod) ? (A.r + B.r - Mod) : (A.r + B.r));
	}
	inline friend mint operator - (const mint& A, const mint& B) {
		return A + mint(Mod - B.r);
	}
	inline friend mint operator * (const mint& A, const mint& B) {
		return mint(1ll * A.r * B.r % Mod);
	}
	inline friend mint& operator += (mint& A, const mint& B) {
		return A = A + B;
	}
	inline friend mint& operator -= (mint& A, const mint& B) {
		return A = A - B;
	}
	inline friend mint& operator *= (mint& A, const mint& B) {
		return A = A * B;
	}
	inline friend mint q_pow(mint p, int k = Mod - 2) {
		mint r = 1;
		for (; k; k >>= 1, p *= p) (k & 1) && (r *= p, 0);
		return r;
	}
};
const int N = 2e6 + 5;
struct node {
	int v, w;
	node() {}
	node(int _v, int _w) : v(_v), w(_w) {}
};
vector<int> G[N], T[N];
int dfn[N], clr[N], val[N], ege[N], num, dic;
int st[N], top;
int tarjan(int u, int lst) {
	int low = dfn[u] = ++dic;
	st[++top] = u;
	for (const int& v : G[u]) {
		if (!dfn[v]) {
			int lowv = tarjan(v, u);
			low = min(low, lowv);
			if (lowv > dfn[u]) {
				++num;
				while (st[top + 1] != v) clr[st[top--]] = num, val[num] ++ ;
			}
		} else if (v != lst) {
			low = min(low, dfn[v]);
		}
	}
	return low;
}
int n, m;
namespace SUB1 {
	bool vis[N];
	int Pw;
	bool dfs(int u, int lst) {
		bool fl = vis[u];
		for (const int& v : T[u]) if (lst != v) {
			if (dfs(v, u)) Pw ++ , fl = 1;
		}
		return fl;
	}
	inline void solve() {
		mint ans = 0;
		rep (S, 1, 1 << n) {
			forn (i, 1, num) vis[i] = 0;
			forn (u, 1, n) if (S >> (u - 1) & 1) vis[clr[u]] = 1;
			forn (i, 1, n) if (vis[clr[i]]) {
				Pw = 0, dfs(clr[i], -1);
				break ;
			}
//			cout << S << ' ' << Pw << '\n';
			ans += q_pow(mint(2), m - Pw);
		}
		cout << ans.r << '\n';
	}
}
namespace SUB2 {
	inline void solve() {
		mint sum = 0;
		if (n == 1) cout << 1 << '\n';
		else {
			sum = mint(n) * q_pow(mint(2), n - 1);
			forn (l, 1, n) sum += mint(n - l) * q_pow(mint(2), n - 2);
			cout << sum.r << '\n';
		}
	}
}
namespace SUB3 {
	mint dp[N][3];
	vector<mint> f, g, h;
	void dfs(int u, int lst) {
		bool lef = 1;
		mint Prd1 = 1, Prd2 = 1;
		for (const int& v : T[u]) {
			if (v == lst) continue ;
			dfs(v, u), lef = 0;
			Prd1 *= mint(2) * dp[v][0];
			Prd2 *= mint(2) * dp[v][0] + dp[v][1];
		}
		if (lef) {
			dp[u][0] = q_pow(mint(2), ege[u]);	
			dp[u][1] = q_pow(mint(2), ege[u]) * (q_pow(mint(2), val[u]) - mint(1));
			dp[u][2] = dp[u][1];
			return ;
		}
		dp[u][0] = q_pow(mint(2), ege[u]) * Prd1;
		dp[u][1] = q_pow(mint(2), ege[u]) * q_pow(mint(2), val[u]) * Prd2 - dp[u][0];
		f.clear(), g.clear(), h.clear();
		int nx = 0;
		for (const int& v : T[u]) {
			if (v == lst) continue ;
			nx ++ ;
			f.push_back(mint(2) * dp[v][0]);
			g.push_back(mint(2) * dp[v][0]);
			h.push_back(mint(2) * dp[v][2]);
		}
		rep (i, 1, nx) f[i] *= f[i - 1];
		form (i, nx - 2, 0) g[i] *= g[i + 1];
		mint Prd3 = 0;
		rep (i, 0, nx) {
			mint cof = 1;
			if (i - 1 >= 0) cof *= f[i - 1];
			if (i + 1 < nx) cof *= g[i + 1];
			Prd3 += h[i] * cof;
		}
		dp[u][2] = q_pow(mint(2), ege[u]) * (q_pow(mint(2), val[u]) - mint(1)) * Prd2 + q_pow(mint(2), ege[u]) * Prd3;
	}
	inline void solve() {
		dfs(1, -1);
		cout << dp[1][2].r << '\n';
	}
}
int main() {
	freopen("barrack.in", "r", stdin);
	freopen("barrack.out", "w", stdout);
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	bool fl = 1;
	cin >> n >> m;
	forn (i, 1, m) {
		int u, v;
		cin >> u >> v;
		fl &= (u == i && v == i + 1);
		G[u].push_back(v);
		G[v].push_back(u);
	}
	if (fl) return SUB2 :: solve(), 0;
	forn (i, 1, n) if (!dfn[i]) {
		G[i + n].push_back(i);
		tarjan(i + n, 0);
	}
//	forn (u, 1, n) cout << clr[u] << " \n"[u == n];
	forn (u, 1, n) for (const int& v : G[u]) 
		if (clr[u] != clr[v]) T[clr[u]].push_back(clr[v]);
		else if (clr[u] == clr[v]) ege[clr[u]] ++ ;
	forn (i, 1, num) ege[i] >>= 1;
	if (n <= 16) SUB1 :: solve();
	else SUB3 :: solve();
	return 0;
}