#include<bits/stdc++.h>
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using ll = long long;
using namespace std;
int read(){
	char c=getchar();int x=0,f=1;
	while(!isdigit(c)){
		if(c=='-') f=-1;
		c=getchar();
	}
	while(isdigit(c)){
		x=(x<<3)+(x<<1)+(c^48);
		c=getchar();
	}
	return f==1?x:~x+1;
}
int n,m;
const int mod=1e9+7;
vector<int>vec[1000010];
unordered_map<int,int>tre[1000010];
int ecnt[1000010],ncnt[1000010];
int cnt;
int dfn[1000010],low[1000010],idx;
int bel[1000010];
bool vis[1000010];
int stk[1000010],top;
void tarjan(int x,int fa){
	dfn[x]=low[x]=++idx;stk[++top]=x;vis[x]=1;
	for(int v:vec[x]) if(v!=fa){
		if(!dfn[v]){
			tarjan(v,x);
			low[x]=min(low[x],low[v]);
		}
		else if(vis[v]) low[x]=min(low[x],dfn[v]);
	}
	if(low[x]==dfn[x]){
		++cnt;
		while(stk[top]!=x){
			vis[stk[top]]=0;
			bel[stk[top]]=cnt;--top;
		}
		vis[x]=0;
		bel[x]=cnt;--top;
	}
}
int pw[1000010];
int dp[1000010][2][2];// in choose?,out choose?
void dfs(int x,int fa){
	dp[x][1][1]=dp[x][1][0]=1ll*pw[ecnt[x]]*(pw[ncnt[x]]-1)%mod;
	dp[x][0][0]=pw[ecnt[x]];
	for(auto ed:tre[x]){
		int v=ed.fi;
		if(v==fa) continue ;
		dfs(v,x);
		dp[v][1][1]=1ll*dp[v][1][1]*(pw[ed.se]-1)%mod;
		dp[v][1][0]=1ll*dp[v][1][0]*pw[ed.se]%mod;
		dp[v][0][0]=1ll*dp[v][0][0]*pw[ed.se]%mod;
		int tmp[2][2]={{0,0},{0,0}};
		tmp[0][0]=1ll*dp[x][0][0]*dp[v][0][0]%mod;
		tmp[1][0]=1ll*dp[x][1][0]*dp[v][1][1]%mod;
		(tmp[1][0]+=1ll*dp[x][0][0]*dp[v][1][0]%mod)%=mod;
		(tmp[1][0]+=1ll*dp[x][1][0]*dp[v][0][0]%mod)%=mod;
		tmp[1][1]=1ll*dp[x][1][1]*dp[v][1][1]%mod;
		(tmp[1][1]+=1ll*dp[x][0][0]*dp[v][1][1]%mod)%=mod;
		(tmp[1][1]+=1ll*dp[x][1][1]*dp[v][0][0]%mod)%=mod;
		dp[x][0][0]=tmp[0][0];
		dp[x][1][1]=tmp[1][1];
		dp[x][1][0]=tmp[1][0];
	}
}
int main(){
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	n=read(),m=read();
	pw[0]=1;
	for(int i=1;i<=m;++i){
		int u=read(),v=read();
		vec[u].pb(v);vec[v].pb(u);
		pw[i]=(pw[i-1]+pw[i-1])%mod;
	}
	for(int i=1;i<=n;++i) if(!dfn[i]) tarjan(i,0);
	for(int i=1;i<=n;++i){
		for(int v:vec[i]){
			if(bel[i]!=bel[v]){
				tre[bel[i]][bel[v]]++;
			}
			else{
				++ecnt[bel[i]];
			}
		}
		++ncnt[bel[i]];
	}
	for(int i=1;i<=cnt;++i) ecnt[i]>>=1;
	dfs(1,0);
	printf("%d\n",dp[1][1][0]);
}