#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
int n,m;
int a[500050],b[500050];
int h[500050],nxt[1000010],ver[1000010],tot;
int h1[500050],nxt1[1000010],ver1[1000010],tot1;
void add(int x,int y){
	ver[++tot]=y;
	nxt[tot]=h[x];
	h[x]=tot;
}
void add1(int x,int y){
	ver1[++tot1]=y;
	nxt1[tot1]=h1[x];
	h1[x]=tot1;
}
int tim,dfn[500050],low[500050],vis[500050],sta[500050],top;
int f[500050];
ll numdot[500050],numedge;
ll dp[500050][2][2];// di i ge jie dian,xia mian you mei you jun ying,beng sheng shi bu shi jun ying
int find(int x){
	if(f[x]==x) return x;
	return f[x]=find(f[x]);
}
ll ksm(ll a,ll b){
	ll ans=1,base=a;
	while(b){
		if(b&1) ans=ans*base%mod;
		base=base*base%mod;
		b>>=1;
	}
	return ans;
}
void tarjan(int x,int fa){
	tim++;
	vis[x]=1;
	dfn[x]=low[x]=tim;
	sta[++top]=x;
	for(int i=h[x];i!=0;i=nxt[i]){
		if(ver[i]==fa) continue;
//		cout<<x<<"->"<<ver[i]<<endl;
		if(vis[ver[i]]==0) tarjan(ver[i],x);
		if(low[ver[i]]<low[x]) low[x]=low[ver[i]];
	}
//	cout<<x<<" "<<dfn[x]<<" "<<low[x]<<endl;
	while(dfn[sta[top]]!=low[x]){
//		cout<<top<<":"<<sta[top]<<endl;
		f[sta[top]]=sta[top-1];
		top--;
	}
	if(sta[top]==x) top--;
}
void dfs(int x,int fa){
	vis[x]=1;
	for(int i=h1[x];i!=0;i=nxt1[i]){
		if(vis[ver1[i]]==1) continue;
		dp[x][0][0]=dp[x][0][0]*2%mod;
		dp[x][1][1]=dp[x][1][1]*(dp[ver1[i]][0][0]+dp[ver1[i]][1][0]+dp[ver1[i]][1][1])%mod;
	}
}
int main(){
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	scanf("%d %d",&n,&m);
	for(int i=1;i<=n;i++){
		f[i]=i;
	}
	for(int i=1;i<=m;i++){
		scanf("%d %d",&a[i],&b[i]);
		add(a[i],b[i]);
		add(b[i],a[i]);
	}
	vis[0]=1;
	tarjan(1,0);
	memset(vis,0,sizeof(vis));
	for(int i=1;i<=n;i++){
		numdot[find(i)]++;
//		cout<<i<<": "<<find(i)<<endl;
	}
	for(int i=1;i<=m;i++){
		ll x=find(a[i]);
		ll y=find(b[i]);
		if(x!=y){
			add1(x,y);
			add1(y,x);
		}
		else numedge++;
	}
	dfs(1,0);
	cout<<ksm(2,numedge)*((dp[1][1][0]+dp[1][1][1])%mod)%mod<<endl;
	return 0;
}
/*
1 0
4 3 1 1
001
010
000
000

*/