#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=5e5+5,M=1e6+6,mod=2e9+7;

struct e{
	ll to,nxt;
} edge[2*M];
ll i,j,n,m,u,v,res,cnt;
ll head[2*M];

void add(int u,int v){
	edge[++cnt].to=v;
	edge[cnt].nxt=head[u];
	head[u]=cnt;
}

int main(){
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	cin>>n>>m;
	for(i=1;i<=m;i++){
		cin>>u>>v;
		add(u,v);
		add(v,u);
	}
	int tmp=1;
	if(n==m+1){
		while(m--) tmp=(tmp*2)%mod;
		cout<<(n*tmp)%mod<<endl;
	}
	else{
		while(m--) tmp=(tmp*2)%mod;
		cout<<(n*tmp)%mod<<endl;
	}
	return 0;
}