#include <bits/stdc++.h>
using namespace std;
const int MOD=int(1e9+7);
int power(int x,int y) {
	int t=x;
	x=1;
	while(y) {
		if(y&1) {
			x=1ll*x*t%MOD;
		}
		t=1ll*t*t%MOD;
		y>>=1;
	}
	return x;
}
const int MAX=1000005;
int tmp,n,m;
int main() {
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++){
		scanf("%d%d",&tmp,&tmp);
	}
	printf("%d",int(1ll*(power(2,n)-1)*power(2,m)%MOD));
	return 0;
}
