#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 5, M = 1e6 + 5, mod = 1e9 + 7;
int n, m, ver[M << 1], tot, nxt[M << 1], head[N], low[N], dfn[N], tot_dfn, bel[N], a[N], edcc_cnt, X[M], Y[M], dp[N][3], pw[M], b[N], sz[N], f[N];
bool bridge[M << 1];
inline void ADD(int &x, int y) {
	((x += y) >= mod && (x -= mod));
}
inline void add(int x, int y) {
	ver[++tot] = y, nxt[tot] = head[x], head[x] = tot;
}
void tarjan(int x, int in_edge) {
	low[x] = dfn[x] = ++tot_dfn;
	for (int i = head[x]; i; i = nxt[i]) {
		int y = ver[i];
		if (!dfn[y]) {
			tarjan(y, i);
			low[x] = min(low[x], low[y]);
			if (low[y] > dfn[x]) bridge[i] = bridge[i ^ 1] = true;
		} else if (i != (in_edge ^ 1)) low[x] = min(low[x], dfn[y]);
	}
}
void dfs(int x) {
	bel[x] = edcc_cnt;
	++a[edcc_cnt];
	for (int i = head[x]; i; i = nxt[i]) {
		int y = ver[i];
		if (bel[y] || bridge[i]) continue;
		dfs(y);
	}
}
void dfs(int x, int fa) {
	sz[x] = 1;
	int cnt = 0;
	for (int i = head[x]; i; i = nxt[i]) {
		int y = ver[i];
		if (y == fa) continue;
		++cnt;
		dfs(y, x);
		sz[x] += sz[y];
	} 
	int tt = 0;
	for (int i = head[x]; i; i = nxt[i]) {
		int y = ver[i];
		if (y == fa) continue;
		b[++tt] = y;
	}
	dp[x][1] = pw[a[x]] - 1;
	for (int i = 1; i <= tt; ++i) 
		dp[x][1] = 1ll * dp[x][1] * (pw[sz[b[i]]] + dp[b[i]][1]) % mod;
	dp[x][2] = 1;
	for (int i = 1; i <= tt; ++i) dp[x][2] = 1ll * dp[x][2] * dp[b[i]][2] % mod;
	dp[x][2] = (dp[x][2] + dp[x][1]) % mod;
}
int main() {
	freopen("barrack.in", "r", stdin);
	freopen("barrack.out", "w", stdout);
	cin >> n >> m;
	pw[0] = 1;
	for (int i = 1; i <= m; ++i) pw[i] = pw[i - 1] * 2ll % mod;
	tot = 1;
	for (int i = 1; i <= m; ++i) {
		scanf("%d%d", X + i, Y + i);
		add(X[i], Y[i]);
		add(Y[i], X[i]);
	}
	if (m == n - 1) {
		f[1] = 1;
		int sum = 0;
		for (int i = 2; i <= n; ++i) {
			f[i] = pw[i - 1];
			ADD(sum, f[i - 1]);
			ADD(f[i], sum);
		}
		int ans = 0;
		for (int i = 1; i <= n; ++i) ADD(ans, 1ll * f[i] * pw[n - i] % mod);
		cout << ans << endl;
		return 0; 
	}
	tarjan(1, 0);
	for (int i = 1; i <= n; ++i)
		if (!bel[i]) ++edcc_cnt, dfs(i);
	tot = 0;
	memset(head, 0, sizeof head);
	int cnt = 0;
	for (int i = 1; i <= m; ++i)
		if (bel[X[i]] != bel[Y[i]]) {
			add(bel[X[i]], bel[Y[i]]);
			add(bel[Y[i]], bel[X[i]]);
		} else ++cnt;
	dfs(1, 0);
	int ans = dp[1][2];
	ans = 1ll * ans * pw[cnt] % mod;
	cout << ans << endl;
}
