#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>

using namespace std;

const int MAXN = 15 + 2;
const int MAXM = 1 << 15;
const int MOD = 1000000000 + 7;

int fpow(int x, int p)
{
	int ret = 1;
	for(; p; p >>= 1, x = (long long)x * x % MOD)
		if(p & 1)
			ret = (long long)ret * x % MOD;
	return ret;
}

int n, m;
vector<int> edg[MAXN];
int cnt[MAXN][MAXM], f[MAXM];

void init()
{
	for(int i = 0; i < n; i++)
		for(int s = 0; s < (1 << n); s++)
		{
			cnt[i][s] = 1;
			for(int j = 0; j < edg[i].size(); j++)
				if((s >> edg[i][j]) & 1)
					cnt[i][s] = cnt[i][s] * 2 % MOD;
		}
}

int main()
{
	ios::sync_with_stdio(false);
	// freopen("1.in", "r", stdin);
	// freopen("1.out", "w", stdout);

	cin >> n >> m;
	for(int i = 1; i <= m; i++)
	{
		int x, y;
		cin >> x >> y;
		x -= 1, y -= 1;
		edg[x].push_back(y);
	}
	init();
	f[0] = 1;
	for(int i = 1; i < (1 << n); i++)
		if(i % 4 == 0 || i % 4 == 3)
		{
			f[i] = 0;
			for(int s = (i - 1) & i; s != i; s = (s - 1) & i)
			{
				int t = i ^ s;
				if((s & 1) ^ ((s >> 1) & 1))
					continue;
				// cerr << s << endl;
				int tmp = f[s];
				for(int j = 0; j < n; j++)
					if((s >> j) & 1)
						tmp = (long long)tmp * (cnt[j][t] - 1 + MOD) % MOD;
					else if((t >> j) & 1)
						tmp = (long long)tmp * cnt[j][s] % MOD;
				f[i] = (f[i] + tmp) % MOD;
			}
			// cerr << i << ' ' << f[i] << endl;
		}

	int ans = (fpow(2, m) - f[(1 << n) - 1] + MOD) % MOD;

	cout << ans << endl;


	return 0;
}
