#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;
long long fpow(long long base,int p){
	if(p==1) return base%mod;
	if(p%2){
		return base%mod*fpow(base,p-1)%mod;
	}
	long long s=fpow(base,p/2);
	return s*s%mod;
}
int main(){
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++){
		int a,b;
		scanf("%d%d",&a,&b);
	}
	cout<<fpow(2,n)+1;
	return 0;
}