#include<bits/stdc++.h>
#define N 500005
#define M 2000005
#define ll long long
#define mod 1000000007
using namespace std;
int read(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-f;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	return x*f;
}
int Head[N],to[M],Next[M];
int n,m,tot=1,ff1=1;
ll p[M],ans,ans1;
bool flag1[45],flag2[45],flag[45],vis[45],flag3[45];
vector<int> E[45][45];
struct edge{
	int u,v;
}a[M];
void add(int u,int v){
	to[++tot]=v,Next[tot]=Head[u],Head[u]=tot;
}
void dfs(int x){
	vis[x]=1;
	for(int i=Head[x];i;i=Next[i]){
		if(flag[i]||flag[i^1]) continue;
		int y=to[i];
		flag[i]=flag[i^1]=1;
		dfs(y);
 	}
}
int main(){
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	n=read(),m=read();
	p[0]=1;
	for(int i=1;i<=m;++i) p[i]=(p[i-1]*2)%mod;
 	for(int i=1;i<=m;++i){
 		int u=read(),v=read();
 		a[i].u=u,a[i].v=v;
 		if((u!=i||v!=i+1)&&(u!=i+1||v!=i)) ff1=0;
	} 
	if(n<=8){
		for(int i=1;i<(1<<n);++i){
			memset(flag1,0,sizeof(flag1));
			int x=i,cnt1=0;
			while(x){
				++cnt1;
				if(x&1) flag1[cnt1]=1;
				x>>=1; 
			}
			for(int j=0;j<(1<<m);++j){
				memset(flag2,0,sizeof(flag2));
				int y=j,cnt2=0;
				while(y){
					++cnt2;
					if(y&1) flag2[cnt2]=1;
					y>>=1;
				}
				int FF=1,cnt=0;
				for(int k=1;k<=m;++k){
					for(int l=1;l<=n;++l) Head[l]=vis[l]=0;
					for(int l=1;l<=m*2+1;++l) flag[l]=0;
					tot=1;
					for(int l=1;l<=m;++l){
						if(flag2[l]||(l!=k)) add(a[l].u,a[l].v),add(a[l].v,a[l].u);
					}
					int root=1;
					for(int l=1;l<=n;++l) if(flag1[l]) root=l;
					dfs(root);
					for(int l=1;l<=n;++l){
						if(flag1[l]&&(!vis[l])) FF=0;
					}
					if(!FF) break;
				}
				ans+=FF;
			}
		}
		printf("%lld\n",ans%mod);
		return 0;
	} 
	ans=0;
	if(m==n-1){
		if(ff1){
			for(int i=1;i<=n;++i){
				if(i<=2) ans=(ans+(ll)(n-i+1)*p[n-i]%mod)%mod;
				else ans=(ans+(ll)(n-i+1)*p[i-2]%mod*p[n-i]%mod)%mod;
			}
			printf("%lld\n",ans);
			return 0;
		}
		
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}
/*

*/