#include<bits/stdc++.h>
using namespace std;
int n,m;
const int N = 5e5 + 10;
vector <int> v[N];
typedef long long ll;
const int mod = 1000000007;
ll mul(ll a,ll b){
	if(a == 0) return 0;
	ll t = 0;
	while(b){
		if(b & 1){
			t = (t + a) % mod;
		}
		a = (a << 1) % mod;
		b >>= 1;
	}
	return t;
}
ll fpow(ll a,ll b){
	ll t = 1;
	while(b){
		if(b & 1) {
			t = mul(t,a) % mod;
		}
		a = mul(a,a) % mod;
		b >>= 1;
	}
	return t;
}
const int M = 1e6 + 10;
ll mi[M];
int out[N];
ll sum;
void ct(int m){
	mi[1] = 1;
	mi[2] = 2;
	sum = 3;
	for(int i = 3;i <= m;i++){
		mi[i] = (mul(2,mi[i - 1]) + fpow(2,i - 3)) % mod;
		sum = (sum + mi[i]) % mod;
	}
	return;
}
int main(){
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	scanf("%d%d",&n,&m);
	for(int i = 1;i <= m;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		out[a]++;
		out[b]++;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	if(n == m){
		for(int i = 1;i <= n;i++){
			if(out[i] == 1){
				ll ans = mul(fpow(2,n),fpow(2,n - 1) - 1) % mod;
				ans = (ans + fpow(2,2 * n - 2)) % mod;
				ans = (ans + fpow(2,n - 1)) % mod;
				printf("%lld\n",ans);
				return 0;
			}
		}
		ll ans = ((fpow(2,n) - 1) * fpow(2,n)) % mod;
	}
	if(m == n - 1){
		ct(n);
		ll ans = 0;
		for(int i = 1;i <= n;i++){
			ans = (ans + mul(mi[i],fpow(2,n - i + 1))) % mod;
		}
		ans = (ans + mod - sum) % mod;
		printf("%lld",ans);
		return 0;
	}
	
	return 0;
}
