#include <bits/stdc++.h>
#define int long long
using namespace std;
const int Mod=1e9+7;
int ans=0;
int n;
vector<bool> used(n+1);
int f(int x,int y) {
	int pro=1;
	for(int i=1;i<=y;i++)
		pro*=x;
	return pro;
}
int eval() {
	int mini=2e9,maxi=2e9;
	for(int i=1;i<=n;i++)
		if(used[i]) {
			mini=i;
			break;
		}
	if(mini==2e9)
		return 0;
	for(int i=n;i>=1;i--)
		if(used[i]) {
			maxi=i;
			break;
		}
	return (f(2,maxi-mini-1)*f(2,n-1-maxi+mini))%Mod;
}
void DFS(int x) {
	if(x==n+1) {
		ans=(ans+eval())%Mod;
		return;
	}
	used[x]=true;
	DFS(x+1);
	used[x]=false;
	DFS(x+1);
}
signed main() {
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	int m;
	cin>>n>>m;
	while(m--) {
		int u,v;
		cin>>u>>v;
	}
	DFS(1);
	cout<<ans;
	return 0;
}
