#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> PII;

const int MOD = 1e9 + 7;
const int MAX_N = 5e5 + 10;
const int MAX_M = 1e6 + 10;

struct NODE{
	int u, v, id;
};

int n, m;
int cnt;
bool vis[MAX_N];
ll Pow2[MAX_N];
vector<NODE> g[MAX_N];
vector<NODE> e;
ll ans;

void read(int &x){
	char c = getchar(); x = 0;
	while (!isdigit(c)) c = getchar();
	while ( isdigit(c)) x = x * 10 + (c ^ '0'), c = getchar();
	return;
}

int dfs(int u, int lim){
	//printf("u = %d, lim = %d\n", u, lim);
	if (vis[u]) return lim;
	vis[u] = true; cnt++;
	for (int i = 0; i < (int) g[u].size(); i++){
		int v = g[u][i].v, id = g[u][i].id;
		if (!((lim >> id) & 1)) continue;
		lim = dfs(v, lim ^ (1 << id));
	}
	return lim;
}

int main(){
	freopen("barrack.in", "r", stdin);
	freopen("barrack.out", "w", stdout);
	read(n); read(m);
	if (n <= 8){
		ans = n;
		Pow2[0] = 1;
		for (int i = 1; i <= n; i++) Pow2[i] = Pow2[i - 1] * 2 % MOD;
		for (int i = 1; i <= m; i++){
			int u, v; 
			read(u); read(v);
			g[u].push_back((NODE) {u, v, i - 1});
			g[v].push_back((NODE) {v, u, i - 1});
			e.push_back((NODE) {u, v, i - 1});
		}
		for (int i = 1; i < (1 << m); i++){
			for (int j = 1; j <= n; j++){
				vis[j] = false;
			}
			//printf("%d:\n", i);
			int tmp = i;
			for (int j = 0; j < m; j++){
				if ((tmp >> j) & 1){
					//printf("id = %d\n", j);
					cnt = 0;
					tmp = dfs(e[j].u, tmp);
					ans = (ans + (Pow2[cnt] - 1 + MOD) % MOD) % MOD;
					//printf("cnt = %d, add = %lld\n", cnt, Pow2[cnt] - 1);
				}
			}
//			if (dfs(e[fi].u, i) == 0){
//				ans = (ans + (Pow2[cnt] - 1 + MOD) % MOD) % MOD;
//				printf("cnt = %d, add = %lld\n", cnt, Pow2[cnt] - 1);
//			}
		}
		printf("%lld\n", ans);
		return 0;
	}
	else if (m == n - 1){
		bool mark = true;
		for (int i = 1; i <= m; i++){
			int u, v; 
			read(u); read(v); if (v != u + 1) mark = false;
		}
		if (mark){
			ll t = 1;
			for (int i = 1; i <= n; i++){
				t = t * 2 % MOD;
				ans = (ans + (t - 1 + MOD) * (n - i + 1) % MOD) % MOD;
			}
			printf("%lld\n", ans);
			return 0;
		}else{
			
		}
	}else{
		
	}
	return 0;
}
