#include<cstdio>
#define db double
#define pc putchar
#define gc getchar
#define ll long long
#define Tp template<typename _T>
#define Me(a,b) memset(a,b,sizeof(a))
Tp _T mabs(_T x){ return x>0?x:-x; }
Tp _T mmin(_T x,_T y){ return x<y?x:y; }
Tp _T mmax(_T x,_T y){ return x<y?y:x; }
Tp void mswap(_T &x,_T &y){ _T t=x; x=y; y=t; return; }
Tp void print(_T x){ if(x<0) pc('-'),x=-x; if(x>9) print(x/10); pc(x%10+48); return; }
#define maxn 500039
#define maxm 2000039
#define MOD 1000000007
using namespace std;
#define Type int
Type read(){
	Type sum=0; char c=gc(); int flag=0;
	while(c!='-'&&(c<'0'||c>'9')) c=gc();
	if(c=='-') flag=1,c=gc();
	while('0'<=c&&c<='9') sum=(sum<<1)+(sum<<3)+(c^48),c=gc();
	if(flag) return -sum; else return sum;
}
int n,m,u[maxn],v[maxn];
ll fastpow(ll x,ll y){
	ll tmp=x,res=1; if(y<=0) return 1;
	while(y){
		if(y&1) res=res*tmp%MOD;
		y>>=1; tmp=tmp*tmp%MOD;
	} return res;
}
namespace S1{
	int vis[139],_u[139],_v[139]; ll ans;
	int fa[139]; int getfa(int x){ if(fa[x]==x) return x; return fa[x]=getfa(fa[x]); }
	void js(){
		int i,j,flag=1,cnt=0,tmp; for(i=1;i<=n;i++) if(vis[i]) flag=0; if(flag) return;
		for(j=1;j<=m;j++){
			for(i=1;i<=n;i++) fa[i]=i;
			for(i=1;i<=m;i++) if(i!=j) fa[getfa(_u[i])]=getfa(_v[i]);
			tmp=flag=0;
			for(i=1;i<=n;i++) if(vis[i]){
				if(!tmp) tmp=getfa(i);
				else if(tmp!=getfa(i)) flag=1;
			} cnt+=flag;
		} ans+=fastpow(2,m-cnt),ans%=MOD;
	}
	void dfs(int x){
		if(x>n){ js(); return; }
		vis[x]=1; dfs(x+1); vis[x]=0; dfs(x+1); return;
	}
	void work(){
		int i; for(i=1;i<=m;i++) _u[i]=u[i],_v[i]=v[i]; dfs(1); print(ans%MOD); return; }
}
namespace S2{
	int check(){
		if(m!=n-1) return 0;
		int i; for(i=1;i<n;i++) if(u[i]!=i||v[i]!=i+1) return 0;
		return 1;
	}
	void work(){
		int i; ll ans=0;
		for(i=1;i<=n;i++) ans+=(n-i+1)*fastpow(2,i-2)%MOD*fastpow(2,n-i)%MOD,ans%=MOD;
		print(ans%MOD);
		return;
	}
}
int main(){
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	n=read(); m=read(); int i; for(i=1;i<=m;i++) u[i]=read(),v[i]=read();
	if(n<=16&&m<=25) S1::work(); else if(S2::check()) S2::work();
	else print(fastpow(2,n)*fastpow(2,m)%MOD);
	return 0;
}
//You can not do it. That's because you are weak, but not the problems are too haed.