#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e6+10;
const int mod=1e9+7;
int n,m;
int mem[3010][3010];
int cnt[N];
int res[N],res2[N];
bool v[N];
ll ans;
int idx,head[N];
struct edge{
	int from,to,next;
}e[N];
void add(int u,int v){
	e[++idx].from=u;
	e[idx].to=v;
	e[idx].next=head[u];
	head[u]=idx;
}
ll qkpow(int x){
	if (x==1) return 2;
	ll a=qkpow(x/2)%mod;
	if (x%2){
		return a*a%mod*2%mod;
	}else{
		return a*a%mod;
	}
}
int read(){
	int x=0,f=1;
	char ch=getchar();
	while (ch<'0'||ch>'9'){
		if (ch=='-') f=-f;
		ch=getchar();
	}
	while (ch>='0'&&ch<='9'){
		x=x*10+ch-'0';
		ch=getchar();
	}
	return x*f;
}
void write(int x){
	if (x<0) putchar('-'),x=-x;
	if (x>9) write(x/10);
	putchar(x%10+'0');
}
int main(){
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	n=read(),m=read();
	for (int i=1;i<=m;i++){
		int u=read(),v=read();
		res[u]++,res[v]++;
		add(u,v);
		add(v,u);
	}
	if (m==n){
		return 0;
	}else if (m==n-1){
		ans=qkpow(m);
		for (int i=2;i<=n;i++){
			ans+=qkpow(i-1)*qkpow(m-i+1);
			ans%=mod;
		}
		write(ans);
	}else {
		return 0;
	}
	//The bloody dusk and The pale dawn.
	fclose(stdin);
	fclose(stdout);
	return 0;
}
