#include<bits/stdc++.h>
using namespace std;
#define N 15
#define mod 1000000007

int n,m,a[N];
long long b[1<<N],f[1<<N];

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

int main(){
	n=read();m=read();
	for (int i=1;i<=m;i++){
		int x=read()-1,y=read()-1;
		a[x]|=1<<y;
	}
	for (int i=b[0]=1;i<(1<<n);i++)
		b[i]=b[i/2]<<(i&1);
	for (int i=f[0]=1;i<(1<<n);i++)
		if ((i&1)==((i>>1)&1))
		for (int j=i;j;j=(j-1)&i)
			if ((j&1)==((j>>1)&1)){
				long long cnt=1;
				for (int k=0;k<n;k++){
					if (j&(1<<k)) cnt=cnt*b[a[k]&(i^j)]%mod;
					if ((i^j)&(1<<k)) cnt=cnt*(b[a[k]&j]-1)%mod;
				}
				f[i]=(f[i]+f[i^j]*cnt)%mod;
			}
	long long tmp=1;
	for (int i=1;i<=m;i++)
		tmp=tmp*2%mod;
	printf("%lld\n",(tmp-f[(1<<n)-1]+mod)%mod);
	return 0;
}