#include<bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Rep(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
const int maxn=5e5+1e3,maxm=2e6+1e3,mod=1e9+7;
inline int read()
{
	int x=0,f=1;char c;
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-f;
	for(;isdigit(c);c=getchar()) x=(x<<1)+(x<<3)+(c^48);
	return x*f;
}
int n,m,f[maxn][2],bit[maxn];
vector<int> ori[maxn],vec[maxn];
bool bl[maxn],insta[maxn];int u[maxn],v[maxn];
int dfn[maxn],low[maxn],dfnclock;
int cnt[maxn],scc,st[maxn],top;
inline void tarjan(int u)
{
	dfn[u]=low[u]=++dfnclock;
	insta[u]=true,st[++top]=u;
	for(int v:ori[u])
	{
		if(!dfn[v]) tarjan(v),low[u]=min(low[u],low[v]);
		else if(insta[u]) low[u]=min(low[u],dfn[v]);
	}
	if(low[u]==dfn[u])
	{
		scc++;
		while(true)
		{
			int x=st[top--];
			cnt[scc]++,
			insta[x]=false;
			bl[x]=scc;
			if(x==u) break;
		}
	}
}
inline void dfs(int u,int fa)
{
	f[u][0]=f[u][1]=1;
	for(int v:vec[u]) if(v^fa)
	{
		dfs(v,u);
		f[u][1]=(f[v][0]*2*f[u][1]+f[v][1]*2*f[u][0]+f[u][1]*f[v][1])%mod;
		f[u][0]=(f[u][0]+f[v][0])%mod;
	}
}
signed main()
{
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	n=read(),m=read();
	bit[0]=1;
	For(i,1,m)
		bit[i]=(bit[i-1]*2)%mod;
	For(i,1,m)
	{
		u[i]=read(),v[i]=read();
		int u=::u[i],v=::v[i];
		vec[u].push_back(v),
		vec[v].push_back(u);
	}
	dfs(1,0);
	printf("%d\n",f[1][1]);
	return 0;
}