#include <bits/stdc++.h>

using namespace std;

const int maxn = 15;
const int mod = 1e9+7;

int n, m;
int out[maxn], in[maxn], sz[1<<maxn];
int dp[1<<maxn];

int lowbit(int x) {return x & (-x);}

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 1; i < (1<<n); i++) sz[i] = sz[i ^ lowbit(i)] + 1;
	for (int i = 1; i <= m; i++) {
		int x, y; scanf("%d%d", &x, &y);
		-- x, -- y;
		out[x] ^= (1<<y), in[y] ^= (1<<x);
	}
	dp[0] = 1;
	for (int mask = 1; mask < (1<<n); ++ mask) {
		for (int s = mask; s; s = (s - 1) & mask) {
			if ((s & 1) && (s & 2)) continue;
			int t = dp[mask ^ s];
			for (int i = 0; i < n; i++) {
				if (s & (1<<i)) {
					t = 1LL * t * (1<<(sz[out[i] & (~ mask)])) % mod;
				} else if (!(mask & (1<<i))) {
					t = 1LL * t * ((1<<sz[s & out[i]]) - 1) % mod;
				}
			}
			dp[mask] = (dp[mask] + t) % mod;
		}
	}
	printf("%d\n", dp[(1<<n)-1]);
	return 0;
}