#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <random>
#include <functional>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;

ll min(ll a, ll b) {return a < b ? a : b;}
ll min(int a, ll b) {return a < b ? a : b;}
ll min(ll a, int b) {return a < b ? a : b;}
ll min(int a, int b) {return a < b ? a : b;}

ll max(ll a, ll b) {return a > b ? a : b;}
ll max(int a, ll b) {return a > b ? a : b;}
ll max(ll a, int b) {return a > b ? a : b;}
ll max(int a, int b) {return a > b ? a : b;}

namespace MySpace{

};

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()

const int N = 16;
const long long MOD = 1e9 + 7;
const int INF = 1e9;
const long long rev2 = (MOD + 1) / 2;

int n, m, a[300], b[300];
int r;
int eto[15][1 << 15];
int dp[1 << 15];
vector<int> graph[N];

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    r = 1;
    for (int i = 0; i < m; i++)
    {
        r = 2 * r % MOD;
        cin >> a[i] >> b[i];
        a[i]--, b[i]--;
        graph[a[i]].push_back(b[i]);
    }
    for (int v = 0; v < n; v++)
    {
        for (int mask = 0; mask < (1 << n); mask++)
        {
            for (auto u : graph[v])
            {
                if ((1 << u) & mask)
                {
                    eto[v][mask]++;
                }
            }
        }
    }
    for (int mask = 0; mask < (1 << n); mask++)
    {
        int t0 = (mask & (1 << 0)) > 0;
        int t1 = (mask & (1 << 1)) > 0;
        if (t0 != t1) continue;
        dp[mask] = 1;
        for (int submask = mask & (mask - 1); submask > 0; submask = (submask - 1) & mask)
        {
            int t0 = (submask & (1 << 0)) > 0;
            int t1 = (submask & (1 << 1)) > 0;
            if (t0 != t1) continue;
            int w = dp[submask];
            for (int i = 0; i < n; i++)
            {
                if ((1 << i) & mask)
                {
                    if ((1 << i) & submask)
                    {
                        w = 1LL * w * ((1 << eto[i][mask - submask]) - 1) % MOD;
                    }
                    else
                    {
                        w = 1LL * w * (1 << eto[i][submask]) % MOD;
                    }
                }
            }
            dp[mask] = (dp[mask] + w) % MOD;
        }
    }
    cout << (r + MOD - dp[(1 << n) - 1]) % MOD;
}


Measured memory_bytes: 2048