#include<bits/stdc++.h>
#define edg(i,u) for(int i=head[u],v;v=edge[i].to,i;i=edge[i].nex)
using namespace std;using ll=long long;const int N=5e5+10,M=1e6+10,mod=1e9+7;
int n,m,kk=1,dfn[N],cnt[N],low[N],scc[N],stk[N],head[N];
ll ans=1,f[N][3],pw[N];
struct edges{int to,nex;}edge[M*2];vector<int>A[N];
void add(int u,int v){edge[++kk]={v,head[u]};head[u]=kk;}
void add_(int u,int v){A[u].push_back(v);A[v].push_back(u);}
void tarjan(int u,int fa=0){
	low[u]=dfn[u]=++dfn[0];stk[++stk[0]]=u;edg(i,u)if(i^fa^1){
		if(!dfn[v])tarjan(v,i),low[u]=min(low[u],low[v]);
		else if(!scc[v])low[u]=min(low[u],dfn[v]);
	}if(dfn[u]==low[u]){
		scc[0]++;do scc[stk[stk[0]]]=scc[0];while(stk[stk[0]--]!=u);
	}
}
void dfs(int u,int fa=0){
	f[u][0]=f[u][2]=1;
	ll x=1,y=0,xx=1,yy=0,tx=1,ty=0;
	for(int v:A[u])if(v^fa){
		dfs(v,u);
		(f[u][0]*=2*f[v][0])%=mod;
		(f[u][2]*=2*f[v][0]+f[v][2])%=mod;
		yy=(yy*(2*f[v][0]+f[v][2])+xx*f[v][2])%mod;
		xx=xx*2*f[v][0]%mod;
		y=(y*2*f[v][0]+x*(2*f[v][1]+f[v][2]))%mod;
		x=x*2*f[v][0]%mod;
	}
	(f[u][2]*=pw[cnt[u]]-1+mod)%=mod;
	(f[u][1]+=y)%=mod;
	(f[u][2]+=yy)%=mod;
}
int main(){
	freopen("barrack.in","r",stdin);freopen("barrack.out","w",stdout);
	scanf("%d%d",&n,&m);for(int u,v;m--;)scanf("%d%d",&u,&v),add(u,v),add(v,u);
	for(int i=1;i<=n;i++)if(!dfn[i])tarjan(i);
	for(int u=1;u<=n;u++)edg(i,u)if(u<v)
		if(scc[u]^scc[v])add_(scc[u],scc[v]);else (ans*=2)%=mod;
	for(int i=pw[0]=1;i<=n;i++)pw[i]=pw[i-1]*2%mod;
	for(int i=1;i<=n;i++)cnt[scc[i]]++;dfs(1);
	cout<<ans*(f[1][1]+f[1][2])%mod;
	return 0;
}
