#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#define fo(i,j,k) for(int i=j;i<=k;++i)
#define fd(i,j,k) for(int i=j;i>=k;--i)
#define ll long long
using namespace std;
const int N=16,M=300,mo=1e9+7;
ll f[1<<N];
int mp[N][1<<N];
int main()
{
	int n,m;
	scanf("%d %d",&n,&m);
	fo(i,1,m){
		int x,y;
		scanf("%d %d",&x,&y);
		mp[x][1<<y-1]=1;
	}
	fo(i,1,n)
	fo(j,1,(1<<n)-1) mp[i][j]=mp[i][j-(j&-j)]+mp[i][(j&-j)];
	f[0]=1;
	fo(S,1,(1<<n)-1) if((S&1)==((S&2)>>1)){
		f[S]=1;
		for(int T=(S-1)&S;T;T=(T-1)&S) if((T&1)==((T&2)>>1)){
			int x=S^T;
			ll t=f[x];
			if(!t) continue;
			fo(i,1,n) if(x&(1<<i-1)) t=t*((1<<mp[i][T])-1)%mo;
			else if(T&(1<<i-1)) t=t*(1<<mp[i][x])%mo;
			f[S]=(f[S]+t)%mo;
		}
	}
	ll ans=1;
	fo(i,1,m) ans=ans*2%mo;
	printf("%lld",(ans-f[(1<<n)-1]+mo)%mo);
}
