#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1e6+10,M=3010,mod=1e9+7;
int n,m,u[N],v[N],a[M][M],c[N],d[N];
bool b[N];
ll ans,t;
ll qpow(int x){
	ll ret=1,t=2;
	while(x){
		if(x&1) ret=ret*t%mod;
		t=t*t%mod,x>>=1;
	}
	return ret;
}
void dfs(int x){
	for(int i=1;i<=n;++i)
		if(a[x][i] && !b[i]){
			b[i]=1;
			dfs(i);
		}
}
void check(int y,int z){
	for(int j=1;j<=z;++j){
		a[u[d[j]]][v[d[j]]]=a[v[d[j]]][u[d[j]]]=0;
		for(int i=1;i<=n;++i) b[i]=0;
		b[c[1]]=1;
		dfs(c[1]);
		for(int i=2;i<=y;++i)
			if(!b[c[i]]) return;
		a[u[d[j]]][v[d[j]]]=a[v[d[j]]][u[d[j]]]=1;
	}
	++ans;
}
void dfb(int x,int y,int z){
	if(x==m+1){
		/*if(y==4){
			for(int i=1;i<=n;++i){
				for(int j=1;j<=n;++j)
					printf("%d ",a[i][j]);
				puts("");
			}
			puts("");
		}*/
		check(y,z);
		return;
	}
	dfb(x+1,y,z);
	d[z+1]=x;
	dfb(x+1,y,z+1);
}
void dfd(int x,int y){
	if(x==n+1){
		for(int i=1;i<=y;++i) printf("%d ",c[i]);
		puts("");
		if(!y) return;
		else if(y==1){
			printf("%lld\n\n",t);
			ans=(ans+t)%mod;
			return;
		}
		int x=ans;
		dfb(1,y,0);
		printf("%lld\n\n",ans-x);
		return;
	}
	dfd(x+1,y);
	c[y+1]=x;
	dfd(x+1,y+1);
}
int main(){
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	int flag=1,x,y,i,j;
	scanf("%d%d",&n,&m);
	for(i=1;i<=m;++i){
		scanf("%d%d",&u[i],&v[i]);
		a[u[i]][v[i]]=a[v[i]][u[i]]=1;
		if(v[i]!=u[i]+1) flag=0;
	}
	if(flag){
		if(n==1){
			puts("1");
			return 0;
		}
		t=qpow(n-2);
		ans=(((1ll*n*n-n)/2*t)%mod+(1ll*n*2*t)%mod)%mod;
		printf("%lld\n",ans);
		return 0;
	}
	t=qpow(m);
	dfd(1,0);
	printf("%lld\n",ans);
	return 0;
}