// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



#define FOR(i,a,b) for (int i = (a); i < (b); i++)

#define RFOR(i,b,a) for (int i = (b) - 1; i >= (a); i--)

#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)

#define FILL(a,value) memset(a, value, sizeof(a))



#define SZ(a) (int)a.size()

#define ALL(a) a.begin(), a.end()

#define PB push_back

#define MP make_pair



typedef long long LL;

typedef vector<int> VI;

typedef pair<int, int> PII;



const double PI = acos(-1.0);

const int INF = 1000 * 1000 * 1000 + 7;

const LL LINF = INF * (LL) INF;



const int MOD = 1000 * 1000 * 1000 + 7;

const int MAX = 16;



VI g[MAX];

int DP[(1<<MAX) + 47];

int n;



int get(int mask)

{

	if (mask == 0) return 1;

	if (DP[mask] != -1) return DP[mask];



	int res = 0;

	int m = mask;

	while(true)

	{

		if (m == 0) break;

		int v1 = (m & 1) > 0;

		int v2 = (m & 2) > 0;

		if (v1 == v2)

		{

			int cur = 1;

			FOR (i, 0, n)

			{

				if (!(mask & (1<<i))) continue;

				if (m & (1<<i)) continue;



				int cnt = 0;

				FOR (j, 0, SZ(g[i]))

				{

					int to = g[i][j];

					if (m & (1<<to)) cnt++;

				}



				cur = (cur * (LL)((1 << cnt) - 1)) % MOD;

			}



			FOR (i, 0, n)

			{

				if (!(m & (1<<i))) continue;



				int cnt = 0;

				FOR (j, 0, SZ(g[i]))

				{

					int to = g[i][j];

					if (mask & (1<<to))

					{

						if (!(m & (1<<to))) cnt++;

					}

				}



				cur = (cur * (LL)(1<<cnt)) % MOD;

			}



			cur = (cur * (LL)get(mask ^ m)) % MOD;



			res = (res + cur) % MOD;

		}



		m = (m - 1) & mask;

	}



	return DP[mask] = res;

}



int main()

{

	//freopen("in.txt", "r", stdin);

	//ios::sync_with_stdio(false); cin.tie(0);



	int m;

	scanf("%d%d", &n, &m);

	FOR (i, 0, m)

	{

		int x, y;

		scanf("%d%d", &x, &y);

		x--;

		y--;



		g[x].PB(y);

	}



	FILL(DP, -1);



	int res = get((1<<n) - 1);



	int p2 = 1;

	FOR (i, 0, m)

	{

		p2 *= 2;

		p2 %= MOD;

	}



	res = p2 - res + MOD;

	res %= MOD;



	cout<<res<<endl;

}




// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<algorithm>

#define MAXN 15

#define MAXS 50000

#define MO 1000000007

using namespace std;

int n,m,all;

int cnt[MAXN+5][MAXS+5],p[MAXN+5][MAXS+5];

int dp[MAXS+5];

bool legal[MAXS+5];

int PowMod(int a,int b)

{

	int ret=1;

	while(b)

	{

		if(b&1)

			ret=1LL*ret*a%MO;

		a=1LL*a*a%MO;

		b>>=1;

	}

	return ret;

}

int LowBit(int i)

{

	return i&(-i);

}

int main()

{

	scanf("%d %d",&n,&m);

	all=1<<n;

	int  u,v;

	for(int i=1;i<=m;i++)

	{

		scanf("%d %d",&u,&v);

		cnt[u][1<<(v-1)]=1;

	}

	for(int i=1;i<=n;i++)

		for(int s=1;s<all;s++)

		{

			int k=LowBit(s);

			cnt[i][s]=cnt[i][s-k]+cnt[i][k];

			p[i][s]=(1<<cnt[i][s])-1;

		}

	for(int s=0;s<all;s++)

		if((s&1)==((s&2)/2))

			legal[s]=true;

	dp[0]=1;

	for(int s=1;s<all;s++)

		if(legal[s])

		{

			dp[s]=1;

			for(int t=((s-1)&s);t;t=((t-1)&s))

				if(legal[t])

				{

					int res=s-t,add=dp[res];

					for(int i=0;i<n;i++)

						if((1<<i)&res)

							add=1LL*add*p[i+1][t]%MO;

						else if((1<<i)&t)

							add=1LL*add*(1LL<<cnt[i+1][res])%MO;

					dp[s]=(1LL*dp[s]+1LL*add)%MO;

				}

		}

	int ans=PowMod(2,m);

	ans=((1LL*ans-1LL*dp[all-1])+MO)%MO;

	printf("%d\n",ans);

	return 0;

}

// Fastest known solution for this problem: