# include <bits/stdc++.h>

using namespace std;

const int N = 17, M = (1 << 15) + 5, mod = 1e9 + 7;

int n, m;
int f[M], _cnt[M];
int G[N];
int p[N];

inline bool chk(int s) {
	return ((s&1) ^ ((s>>1) & 1));
}

int main() {
	int sz;
	cin >> n >> m;
	sz = (1 << n) - 1;
	for (int i=1, u, v; i<=m; ++i) { 
		cin >> u >> v;
		G[u] |= (1 << v-1);
	}
	for (int S = 0; S <= sz; ++S) 
		for (int i=0; i<n; ++i) if((S >> i) & 1) ++_cnt[S];
	f[0] = 1;
	for (int S = 1; S <= sz; ++S) {
		if(chk(S)) continue;
		for (int U = S; U; U = (U-1) & S) {
			if(chk(U)) continue;
			int T = (S ^ U), res = 1;
			for (int i=1, t; i<=n; ++i) {
				if(!((S >> i-1) & 1)) continue;
				if((T >> i-1) & 1) {
					t = (1 << _cnt[G[i] & U]) - 1;
					t %= mod;
					res = 1ll * res * t % mod;		
				} else {
					t = (1 << _cnt[G[i] & T]);
					t %= mod;
					res = 1ll * res * t % mod;
				}
			}
			f[S] += 1ll * res * f[T] % mod;
			if(f[S] >= mod) f[S] -= mod;
		}
	}
	int tot = 1;
	for (int i=1; i<=m; ++i) {
		tot <<= 1;
		if(tot >= mod) tot -= mod;
	}
	tot -= f[sz];
	if(tot < 0) tot += mod;
	cout << tot << endl;
	
	return 0;
}

 