#include<bits/stdc++.h>
#define maxn 500005
#define maxe 1000005
#define TT 1000000007
using namespace std;
int n,m;
long long ans;
inline int read(){
	int ret=0;char ch=getchar();
	while(!isdigit(ch)) ch=getchar();
	while(isdigit(ch)) ret=ret*10+ch-'0',ch=getchar();
	return ret;
}
long long qsm(long long x,int y){
	long long ret=1;
	while(y){
		if(y&1) ret=ret*x%TT;
		y>>=1,x=x*x%TT;
	}
	return ret;
}
int main(){
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	n=read(),m=read();
	for(int i=1;i<=m;i++){
		int x=read(),y=read();
	}
	for(int i=0;i<n;i++){
		ans=(ans+(n-i)*qsm(2ll,m-i))%TT;
	}printf("%lld\n",ans);
	return 0;
}
//This is my last time...