#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL MOD=1e9+7;
const int NUM=500005;
int read()
{
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9')
	{
		if(c=='-') f=-1;
		c=getchar();
	}
	while('0'<=c&&c<='9')
	{
		x=x*10+(c-'0');
		c=getchar();
	}
	return x*f;
}
int n,m,num,head[NUM],num2=1,head2[NUM];
int cnt,dfn[NUM],low[NUM],cnt_c,c[NUM],top,stk[NUM];
LL dp[NUM][3],c_ee[NUM],c_pp[NUM],fsp[NUM];
bool instk[NUM],vis[NUM];
struct edge
{
	int next,to;
}e[NUM<<2],e2[NUM<<2];
void add_edge(int from,int to)
{
	e[++num].next=head[from];
	e[num].to=to,head[from]=num;
}
void add_edge2(int from,int to)
{
	e2[++num2].next=head2[from];
	e2[num2].to=to,head2[from]=num2;
}
void tarjan(int u,int fa)
{
	int v;
	stk[++top]=u;
	instk[u]=true;
	dfn[u]=low[u]=++cnt;
	for(int i=head2[u];i;i=e2[i].next)
	{
		if((fa^1)==i) continue;
		v=e2[i].to;
		if(!dfn[v])
		{
			tarjan(v,i);
			low[u]=min(low[u],low[v]);
		}
		else
		{
			if(instk[v])
				low[u]=min(low[u],dfn[v]);
		}
	}
//	printf("%d %d %d\n",u,dfn[u],low[u]);
	if(dfn[u]==low[u])
	{
		cnt_c++;
		while(stk[top]!=u)
		{
			c[stk[top]]=cnt_c;
			instk[stk[top]]=false;
			top--;
		}
		c[stk[top]]=cnt_c;
		instk[stk[top]]=false;
		top--;
	}
}
void dfs(int u,int fa)
{
	int v;
	vis[u]=true;
	dp[u][2]=0;
	dp[u][0]=fsp[c_ee[u]];
	dp[u][1]=fsp[c_ee[u]]*(MOD+fsp[c_pp[u]]-1)%MOD;
	for(int i=head[u];i;i=e[i].next)
	{
		v=e[i].to;
		if(vis[v]) continue;
		dfs(v,u);
		dp[u][1]=(dp[u][1]*((dp[v][0]*2+dp[v][1])%MOD)%MOD
				 +dp[u][0]*dp[v][1]%MOD)%MOD;
		dp[u][2]=(dp[u][2]*((dp[v][0]*2)%MOD)%MOD
		         +dp[u][0]*((dp[v][1]+dp[v][2]*2)%MOD)%MOD)%MOD;
		dp[u][0]=dp[u][0]*dp[v][0]*2%MOD;
//		printf("%d %lld %lld %lld\n",u,dp[u][0],dp[u][1],dp[u][2]);
	}
//	printf("%d %lld %lld %lld\n",u,dp[u][0],dp[u][1],dp[u][2]);
}
int main()
{
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	int u,v;
	fsp[0]=1;
	n=read(),m=read();
	for(int i=1;i<=n||i<=m;i++) fsp[i]=(fsp[i-1]*2)%MOD;
	for(int i=1;i<=m;i++)
	{
		u=read(),v=read();
		add_edge2(u,v),add_edge2(v,u);
	}
	for(int i=1;i<=n;i++)
		if(!dfn[i]) tarjan(i,0);
	for(int i=1;i<=n;i++)
	{
		c_pp[c[i]]++;
		for(int j=head2[i];j;j=e2[j].next)
		{
			v=e2[j].to;
			if(c[i]==c[v]) c_ee[c[i]]++;
			else add_edge(c[i],c[v]);
		}
	}
//	for(int i=1;i<=n;i++) printf("%d ",c[i]);printf("\n");
//	for(int i=1;i<=cnt_c;i++) printf("%lld %lld\n",c_ee[i],c_pp[i]);
	for(int i=1;i<=cnt_c;i++) c_ee[i]>>=1;
	dfs(1,0);
	printf("%lld",(dp[1][1]+dp[1][2])%MOD);
}