#include<bits/stdc++.h>
#define pb push_back
using namespace std;
const int N=5e5+3;
const int p=1e9+7;
typedef long long ll;

int n,m;
vector<int>g[N];
inline void add(int u,int v) {
	g[u].pb(v);
	g[v].pb(u);
}
ll ans;
signed main() {
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	scanf("%d%d",&n,&m);
	for(int u,v,i=1; i<=m; ++i) {
		scanf("%d %d",&u,&v);
		add(u,v);	
	}
	if(m==n-1){
		for(int i=1;i<=n;++i){
			ans=(ans+(1<<(m-i+1)%p*(n-i+1)))%p;
		}
		printf("%lld",(ans+p)%p);
		return 0;
	}
	++ans;
	ans=(ans+(1<<m)%p*n)%p;
	printf("%lld",ans);
	return 0;
}
/*
2 1
1 2
*/