#include<cstdio>
#include<algorithm>
using namespace std;
const int INF=1000000007;
const int N=5000000;
long long d[N][2],f[N],a[N],a1,ans,n,m,x,y,b[100],c[100];
bool A;
void aa(){
	ans=a[n-1]*n%INF;
	a1=1;
	a1=n*(n-1)/2%INF;
	a1=a1*(a[n-2])%INF;
	ans=(ans+a1)%INF;
}
int find(int x){
	if (f[x]==x)
		return x;
		else return find(f[x]);
}
void bb(int n1,int m1){
	if (n1>n&&m1>m){
		for (int i=1;i<=n;i++)	f[i]=i;
		for (int i=1;i<=m;i++){
			if (c[i]){
				x=d[i][0];y=d[i][1];
				f[y]=find(x);
			}
		}
		int check=1,tt=0,ttt=0;
		for (int i=1;i<=n;i++){
			if (b[i]){
				ttt=1;
				if (tt==0)tt=find(i);
				//printf("%d %d\n",tt,find(i));
				if (find(i)!=tt){check=0;break;	} 
			}
		}
		if (check&&ttt){
			ans++;
		}
		return;
	}
	if (n1<=n){
		b[n1]=1;
		bb(n1+1,m1);
		b[n1]=0;
		bb(n1+1,m1);
	}
	if (n1>n&&m1<=m){
		c[m1]=1;
		bb(n1,m1+1);
		c[m1]=0;
		bb(n1,m1+1);
	}
}
int main(){
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	scanf("%d %d",&n,&m);
	//printf("%d %d\n",n,m);
	if (m==n-1)A=1;
	a[0]=1;
	for (int i=1;i<=max(n,m);i++){
		a[i]=(a[i-1]*2)%INF;
	}
	for (int i=1;i<=m;i++){
		scanf("%d %d",&x,&y);
		d[i][0]=x;d[i][1]=y;
		if ((x==i&&y==i+1)||(x==i+1&&y==i)){
			a1=0;
		}else A=0;
	}
	if (A)
	aa();else
	bb(1,1);
	printf("%lld",ans);
}
