#include<cstdio>
#include<algorithm>
#define fo(i,a,b) for(i=a;i<=b;i++)
using namespace std;
typedef long long ll;
const int mo=1000000007;
bool bz[15+5][15+5];
int two[300],id[1<<17];
int f[15+5][1<<17],g[15+5][1<<17],dp[1<<17];
int i,j,k,l,r,s,t,n,m,ans;
int lowbit(int x){
	return x&-x;
}
int main(){
	scanf("%d%d",&n,&m);
	fo(i,1,n) id[1<<(i-1)]=i;
	two[0]=1;
	fo(i,1,m) two[i]=(ll)two[i-1]*2%mo;
	fo(i,1,m){
		scanf("%d%d",&j,&k);
		bz[j][k]=1;
	}
	fo(i,1,n)
		fo(s,1,(1<<n)-1)
			f[i][s]=f[i][s-lowbit(s)]+bz[i][id[lowbit(s)]];
	fo(i,1,n)
		fo(s,1,(1<<n)-1){
			k=id[lowbit(s)];
			if (!bz[i][k]) g[i][s]=g[i][s-lowbit(s)];
			else g[i][s]=((ll)g[i][s-lowbit(s)]*2%mo+1)%mo;
		}
	fo(s,1,(1<<n)-1){
		//if (!((s&1)&&(s&2))) continue;
		dp[s]=1;
		t=(s-1)&s;
		while (t){
			if (((s^t)&1)&&(t&2)){
				t=(t-1)&s;
				continue;
			}
			if (((s^t)&2)&&(t&1)){
				t=(t-1)&s;
				continue;
			}
			r=1;
			fo(i,1,n)
				if ((t&(1<<(i-1)))) r=(ll)r*g[i][s^t]%mo;
			l=0;
			fo(i,1,n)
				if (((s^t)&(1<<(i-1)))) l+=f[i][t];
			r=(ll)r*two[l]%mo;
			(dp[s]+=(ll)dp[t]*r%mo)%=mo;
			t=(t-1)&s;
		}
	}
	ans=(two[m]-dp[(1<<n)-1])%mo;
	(ans+=mo)%=mo;
	printf("%d\n",ans);
}