#include <bits/stdc++.h>

using namespace std;

using ll = long long;

const int MOD = 1e9 + 7;

int main() {
   ios_base::sync_with_stdio(false);
   int N, M;
   cin >> N >> M;
   vector<int> adj(N);
   for (int i = 0; i < M; ++i) {
      int v, u;
      cin >> v >> u;
      --v, --u;
      adj[v] |= (1 << u);
   }
   vector<int> popcnt(1 << N);
   for (int i = 1; i < (1 << N); ++i) {
      popcnt[i] = popcnt[i >> 1] + (i & 1);
   }
   vector<int> dp(1 << N);
   for (int mask = 1; mask < (1 << N); ++mask) {
      if ((mask & 3) == 1 || (mask & 3) == 2) continue;
      dp[mask] = 1;
      for (int posMask = (mask - 1) & mask; posMask > 0; posMask = (posMask - 1) & mask) {
         if ((posMask & 3) == 1 || (posMask & 3) == 2) continue;
         int zeroMask = mask ^ posMask;
         int ways = dp[posMask];
         for (int i = 0; i < N; ++i) {
            if (posMask >> i & 1) {
               ways = ll(ways) * ((1 << popcnt[adj[i] & zeroMask]) - 1) % MOD;
            } else if (zeroMask >> i & 1) {
               ways = ll(ways) * (1 << popcnt[adj[i] & posMask]) % MOD;
            }
         }
         dp[mask] += ways;
         if (dp[mask] >= MOD) dp[mask] -= MOD;
      }
   }
   int ans = 1;
   for (int i = 0; i < M; ++i) {
      ans += ans;
      if (ans >= MOD) ans -= MOD;
   }
   ans -= dp[(1 << N) - 1];
   if (ans < 0) ans += MOD;
   cout << ans << "\n";
   return 0;
}
