#include <bits/stdc++.h>

#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define per(i, a, b) for (int i = a; i >= b; --i)
#define int long long

using namespace std;

const int N = 1e5 + 5, P = 1e9 + 7;


int n, m, jc[N], inv[N];
vector<int> e[N];

int power(int a, int b) {
	int res = 1;
	for (; b; b >>= 1, a = a * a % P)
		if (b & 1) res = res * a % P;
	return res;
}

void init(int n) {
	jc[1] = inv[0] = inv[1] = 1;
	rep(i, 2, n) jc[i] = jc[i - 1] * i % P;
	inv[n] = power(jc[n], P - 2);
	per(i, n - 1, 1) inv[i] = inv[i + 1] * (i + 1) % P;
}

signed main() {
	freopen("barrack.in", "r", stdin);
	freopen("barrack.out", "w", stdout);
	cin.tie(nullptr)->sync_with_stdio(false);
	cin >> n >> m;
	for (int i = 1; i <= m; ++i) {
		int u, v;
		cin >> u >> v;
		e[u].emplace_back(v);
		e[v].emplace_back(u);
	}
	if (m == n - 1) {
		int ans = n * power(2, m) % P;
		rep(i, 2, n) {
			ans = (ans + (n - i + 1) * power(2, i - 2) % P * power(2, m - (i - 1)) % P) % P;
		}
		cout << ans << '\n';
		return 0;
	}
	return 0;
}
