#include<bits/stdc++.h>
using namespace std;

inline int read(){
	int n=0,f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-') f=-1;ch=getchar();}
	while(isdigit(ch)){n=n*10+ch-'0';ch=getchar();}
	return n*f;
}

const int N=5e5+10,M=1e6+10,mod=1e9+7;
int n,m,cnt,ans;
int fa[N],ton[N];
bool mark[N],pro[M];
struct node{
	int u,v;
}e[N];
int find(int x){
	return fa[x]==x?x:fa[x]=find(fa[x]);
}
void add(int u,int v){
	e[++cnt].v=v;
	e[cnt].u=u;
}
void dfs(int now){
	if(now==m+1){
		int cct=0;
		for(int l=1;l<=m;l++){
			int tot=0;
			memset(ton,0,sizeof(ton));
			for(int i=1;i<=n;i++){
				fa[i]=i;
				if(mark[i]) tot++;
			}
			for(int i=1;i<=m;i++){
				if(i==l){
					if(!pro[i]) continue;
				}
				int u=find(e[i].u),v=find(e[i].v);
				if(u!=v) fa[v]=u;
			}
			int ct=0;
			for(int i=1;i<=n;i++){
				if(mark[i]) if(!ton[find(i)]) ct++,ton[find(i)]=1;
			}
			if(ct==1||tot==1){
				cct++;
			}
		}
		if(cct==m) ans=(ans+1)%mod;
		return;
	}
	pro[now]=1;
	dfs(now+1);
	pro[now]=0;
	dfs(now+1);
}
void dfs1(int now){
	if(now==n+1){
		dfs(1);
		return;
	}
	mark[now]=1;
	dfs1(now+1);
	mark[now]=0;
	dfs1(now+1);
}
int main(){
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	n=read(),m=read();
	for(int i=1;i<=m;i++){	
		int u=read(),v=read();
		add(u,v);
	}
	dfs1(1);
	printf("%d\n",ans);
	return 0;
}
/*
4 4
1 2
2 3
3 1
1 4
*/