#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 20, mod = 1e9 + 7;
int n, m, cnt, e[N], f[1 << N], sz[1 << N], ans;

int main() {
	scanf("%d%d", &n, &m), cnt = (1 << n) - 1, f[0] = 1;
	for(int i = 1, x, y; i <= m; i++) scanf("%d%d", &x, &y), --x, --y, e[x] |= (1 << y);
	for(int i = 1; i <= cnt; i++) sz[i] = sz[i >> 1] + (i & 1);
	for(int i = 0; i <= cnt; i++) sz[i] = 1 << sz[i];
	for(int i = 2; i <= cnt; i++) if((i & 1) == ((i >> 1) & 1)) {
		for(int j = i; j; j = i & (j - 1)) if((j & 1) == ((j >> 1) & 1)) {
			int w = 1, v = (i ^ j);
			for(int k = 0; k < n; k++) if(i & (1 << k)) {
				if(j & (1 << k)) w = (ll)w * sz[e[k] & v] % mod;
				else w = (ll)w * (sz[e[k] & j] - 1) % mod;
			}
			f[i] = (f[i] + (ll)w * f[v] % mod) % mod;
		}
	}
	ans = 1; for(int i = 1; i <= m; i++) ans = (ans + ans) % mod;
	printf("%d\n", (ans + mod - f[cnt]) % mod);
	return 0;
}