#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll P(1e9+7);
const int N(5e5+5),M(1e6+5);
int n;
int head[N],nex[M<<1],to[M<<1],tot;
void add(int x,int y){
	nex[++tot]=head[x];
	head[x]=tot;
	to[tot]=y;
}
int siz[N];
int m;
int dfn[N],low[N],cnt;
int q[N],top;
bool in[N];
int scc[N],sc,sz2[N];
void Tarjan(int x,int fa){
	dfn[x]=low[x]=++cnt;
	q[++top]=x;in[x]=1;
	int y;
	for(int i=head[x];i;i=nex[i]){
		y=to[i];if(y==fa) continue;
		if(!dfn[y]) Tarjan(y,x),low[x]=min(low[x],low[y]);
		else if(in[y]) low[x]=min(low[x],dfn[y]);
	}
	in[x]=0;
	if(dfn[x]==low[x]){
		y=-1;
		++sc;
		while(y!=x){
			y=q[top--];
			scc[y]=sc;
			++siz[sc];
		}
	}
}
vector<int> e[N];
ll qp[N];
ll f[2][N];
void dfs(int x,int fa){
	if(f[0][x]) return ;
	f[0][x]=(qp[sz2[x]]+1)%P;f[1][x]=qp[siz[x]]*qp[sz2[x]]%P;
	for(auto y:e[x]){
		if(y==fa) continue;
		dfs(y,x);
		f[0][x]*=f[0][y]*2ll%P;f[0][x]%=P;
		f[1][x]*=(f[0][y]*2ll%P+f[1][y])%P;f[1][x]%=P;
	}
	
}
int main(){
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	ios::sync_with_stdio(0);
	cin>>n>>m;int x,y;
	qp[0]=1;
	for(int i=1;i<=n;++i) qp[i]=qp[i-1]*2ll%P;
	for(int i=1;i<=n;++i) qp[i]--;
	for(int i=1;i<=m;++i){
		cin>>x>>y;
		add(x,y),add(y,x);
	}
	Tarjan(1,1);
	for(int i=1;i<=n;++i){
		for(int j=head[i];j;j=nex[j]){
			y=to[j];
			if(scc[i]==scc[y]) {
				++sz2[scc[i]];
				continue;
			}
			e[scc[i]].push_back(scc[y]);
			e[scc[y]].push_back(scc[i]);
		}
	}
	dfs(1,1);
//	for(int i=1;i<=n;++i) cout<<f[0][i]<<' '<<f[1][i]<<endl;
	cout<<(f[0][1]+f[1][1])%P<<endl;
}