#include <bits/stdc++.h>
using namespace std;
#define F(i, s, t) for (int i = (s), _ = (t); i <= _; i ++)
#define Fo(i, s, t) for (int i = (s), _ = (t); i < _; i ++)
#define LL long long
const int N = 20;
const int S = 40000;
const int P = 1000000007;
int n, m, gr[N];
int p2[N*N], fu, cnt[S], edc[N][S];
int f[S];
int rd() {
int x = 0; char c;
do { c = getchar(); } while (!isdigit(c));
do { x = x*10+c-'0', c = getchar(); } while (isdigit(c));
return x;
}
int Ju(int s) { return (s & 3) == 0 || (s & 3) == 3; }
int main() {
#ifndef ONLINE_JUDGE
freopen("F.in", "r", stdin);
#endif
n = rd(), m = rd();
F(i, 1, m) {
int x = rd(), y = rd();
gr[x] |= (1 << y-1);
}
p2[0] = 1;
F(i, 1, n*n) p2[i] = p2[i-1] * 2 % P;
fu = 1 << n;
Fo(i, 1, fu) cnt[i] = cnt[i - (i & -i)] + 1;
F(i, 1, n)
Fo(s, 0, fu)
edc[i][s] = cnt[gr[i] & s];
f[0] = 1;
Fo(s, 1, fu) if (Ju(s)) {
for (int a = (s-1) & s; ; a = (a-1) & s) if (Ju(a) && f[a]) {
int b = s-a, m = 1;
F(i, 1, n)
if (a >> i-1 & 1)
m = (LL)m * (p2[edc[i][b]] - 1) % P;
F(i, 1, n)
if (b >> i-1 & 1)
m = (LL)m * p2[edc[i][a]] % P;
f[s] = (f[s] + (LL)f[a] * m) % P;
if (!a) break;
}
}
cout << (p2[m] - f[fu-1] + P) % P << endl;
return 0;
}