#include<bits/stdc++.h>
using namespace std;
/*------------------------------fast io begin------------------------------*/
namespace Fread{
	const int SIZE=1<<16;
	char buf[SIZE],*S,*T;
	inline char getchar(){
		if(S==T){
			T=(S=buf)+fread(buf,1,SIZE,stdin);
			if(S==T)return '\n';
		}
		return *S++;
	}
}
namespace Fwrite{
	const int SIZE=1<<16;
	char buf[SIZE],*S=buf,*T=buf+SIZE;
	inline void flush(){
		fwrite(buf,1,S-buf,stdout);
		S=buf;
	}
	inline void putchar(char c){
		*S++=c;
		if(S==T)flush();
	}
	struct GreyCrane{
		~GreyCrane(){flush();}
	}HuiHe;
}
#define getchar Fread::getchar
#define putchar Fwrite::putchar
template<typename T>inline void read(T&x){
	x=0;T f=1;char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-f;c=getchar();}
	while(isdigit(c))x=x*10+(c^48),c=getchar();
	x*=f;
}
inline void read(string&s){
	char c=getchar();s="";
	while(c==' '||c=='\n'||c=='\r')c=getchar();
	while(!(c==' '||c=='\n'||c=='\r'))s+=c,c=getchar();
}
template<typename T>inline void write(T x){
	if(x==0)putchar('0');
	else{
		if(x<0)putchar('-'),x=-x;
		static int sta[45];int top=0;
		while(x)sta[++top]=x%10,x/=10;
		while(top)putchar(sta[top--]+48);
	}
}
inline void write(char c){putchar(c);}
/*------------------------------fast io end------------------------------*/
#define all(x) x.begin(),x.end()
#define siz(x) ((int)x.size())
#define ll long long
#define pb push_back
#define fi first
#define se second
#define edl putchar('\n')
#define spc putchar(' ')
const int N=5e5+5,M=1e6+5;
const long long mod=1e9+7;
int n,m;
struct edge{
	int next,to;
}E[M<<1];
int head[N],cnt=1;
inline void add(int x,int y){
	E[++cnt]={head[x],y};
	head[x]=cnt;
}
int dfn[N],low[N],tot,sta[N],top,scc[N],col,siz[N],rd[N],Siz[N];
inline void Tarjan(int x,int ed){
	dfn[x]=low[x]=++tot;
	sta[++top]=x;
	for(int i=head[x];i;i=E[i].next){
		int y=E[i].to;
		if(!dfn[y]){
			Tarjan(y,i);
			low[x]=min(low[x],low[y]);
		}else if(i!=(ed^1))low[x]=min(low[x],dfn[y]);
	}
	if(dfn[x]==low[x]){
		scc[x]=++col;
		while(sta[top]!=x)scc[sta[top--]]=col;
		top--;
	}
}
vector<int>e[N];
int u[M],v[M];
long long dp[N][3],_2[N];
inline void dfs(int x,int fa){
	dp[x][0]=(_2[siz[x]]-1+mod)%mod;
	dp[x][1]=1;
	dp[x][2]=_2[rd[x]];
	int son=0;
	for(auto y:e[x]){
		if(y==fa)continue;
		dfs(y,x);
		son++;
		dp[x][0]=dp[x][0]*(dp[y][0]+2*dp[y][2])%mod;
		dp[x][1]=dp[x][1]*(dp[y][0]*2+dp[y][1]*2)%mod;
		dp[x][2]=dp[x][2]*dp[y][2]*2%mod;
	}
	dp[x][0]=dp[x][0]*_2[rd[x]]%mod;
	dp[x][1]=dp[x][1]*_2[rd[x]]%mod;
	if(!son)dp[x][1]=0;
//	cerr<<x<<" : "<<dp[x][0]<<" "<<dp[x][1]<<" "<<dp[x][2]<<endl;
}
int main(){
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	read(n),read(m);
	for(int i=1;i<=m;i++){
		read(u[i]),read(v[i]);
		add(u[i],v[i]),add(v[i],u[i]);
	}
	for(int i=1;i<=n;i++)if(!dfn[i])Tarjan(i,0);
	for(int i=1;i<=n;i++)siz[scc[i]]++;
	for(int i=1;i<=m;i++){
		if(scc[u[i]]!=scc[v[i]]){
			e[scc[u[i]]].pb(scc[v[i]]);
			e[scc[v[i]]].pb(scc[u[i]]);
		}else rd[scc[u[i]]]++;
	}
	_2[0]=1;
	for(int i=1;i<=n;i++)_2[i]=_2[i-1]*2%mod;
	dfs(1,0);
	write((dp[1][0]+dp[1][1])%mod),edl;
	return 0;
}
/*
6 7
1 2
1 3
2 3
3 4
4 5
4 6
5 6

3 2
1 2
1 3

*/
