#include<iostream>
#include<cstdio>

#define int long long
using namespace std;

const int maxn = 2e6 + 5,mo = 1e9 + 7;

int n,m,x,y,pw[maxn];

signed main() {
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	pw[0] = 1;
	for (int i=1; i<maxn; i++)
		pw[i] = (pw[i - 1] * 2) % mo;
	
	scanf("%lld %lld",&n,&m);
	for (int i=1; i<=m; i++)
		scanf("%lld %lld",&x,&y);
	
	int ans = 0;
	for (int i=n; i>=1; i--)
		ans = (ans + (i * pw[i - 1]) % mo) % mo;
	printf("%lld\n",ans);
	
	return 0;
}