#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i,x,y,z) for(long long i=x;i<=y;i+=z)
#define fd(i,x,y,z) for(long long i=x;i>=y;i-=z)
const ll mod=1e9+7;
ll n,m;
vector<ll> v[500005];
ll qpow(ll x,ll y){
	ll tot=1;
	while(y){
		if(y&1){
			tot=tot*x;
			tot=tot%mod;
		}
		x=x*x;
		x%=mod;
		y>>=1;
	}
	return tot;
}
int main(){
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	scanf("%lld%lld",&n,&m);
	f(i,1,m,1){
		ll xx,yy;
		scanf("%lld%lld",&xx,&yy);
		v[xx].push_back(yy);
		v[yy].push_back(xx);
	}
	ll ans=qpow(2,n)%mod;
	ans--;
	ans*=qpow(2,m)%mod;
	ans%=mod;
	printf("%lld\n",ans);
	return 0;
}
/*
I can only get 0./kk
*/