#include <bits/stdc++.h>
using namespace std;
using ll = long long;
inline ll read() {
  ll x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 1) + (x << 3) + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const ll N = 4e3 + 10, mod = 1e9 + 7;
ll fa[N], n, m, Size[N], cnt, a[N], f[2][N << 1][2];
inline ll find(ll x) { return x == fa[x] ? x : fa[x] = find(fa[x]); }
int main() {
  n = read();
  m = read();
  for (ll i = 1; i <= n; ++i) {
    fa[i] = i;
    Size[i] = 1;
  }
  for (ll i = 1; i <= m; ++i) {
    ll u = find(read()), v = find(read());
    if (u == 1 || v == 1 || u == v) continue;
    fa[v] = u;
    Size[u] += Size[v];
  }
  for (ll i = 2; i <= n; ++i)
    if (fa[i] == i) a[++cnt] = Size[i] + 1;
  ll zero = m + 1, t = 1, ans;
  f[0][zero][0] = 1;
  for (ll i = 1; i <= cnt; ++i, t ^= 1) {
    for (ll j = 1; j <= (m << 1 | 1); ++j) {
      f[t][j][0] = f[t ^ 1][j][0];
      f[t][j][1] = f[t ^ 1][j][1];
    }
    for (ll j = 1; j <= (m << 1 | 1); ++j) {
      if (j - a[i]) {
        f[t][j][0] = (f[t][j][0] + f[t ^ 1][j - a[i]][0]) % mod;
        f[t][j][1] = (f[t][j][1] + f[t ^ 1][j - a[i]][1]) % mod;
      }
      if (j + a[i] < (m + 1 << 1)) {
        f[t][j][0] = (f[t][j][0] + f[t ^ 1][j + a[i]][0]) % mod;
        f[t][j][1] = (f[t][j][1] + f[t ^ 1][j + a[i]][1]) % mod;
      }
    }
    for (ll j = 1; j <= (m << 1 | 1); ++j)
      f[t ^ 1][j][0] = (f[t ^ 1][j][0] + f[t ^ 1][j - 1][0]);
    for (ll j = 1; j <= (m << 1 | 1); ++j) {
      ll l = ((1) > (j - a[i] + 2) ? (1) : (j - a[i] + 2)),
         r = ((j + a[i] - 2) < ((m << 1 | 1)) ? (j + a[i] - 2)
                                              : ((m << 1 | 1)));
      f[t][j][1] =
          (f[t][j][1] + (f[t ^ 1][r][0] + mod - f[t ^ 1][l - 1][0]) % mod) %
          mod;
    }
  }
  ans = (f[t ^ 1][zero][1] << 1) % mod;
  for (ll j = 1; j <= (m << 1 | 1); ++j)
    f[t][j][0] = f[t ^ 1][j][0] = f[t][j][1] = f[t ^ 1][j][1] = 0;
  f[t ^ 1][zero][0] = 1;
  for (ll i = 1; i <= cnt; ++i, t ^= 1) {
    for (ll j = 1; j <= (m << 1 | 1); ++j) f[t][j][0] = f[t][j][1] = 0;
    for (ll j = 1; j <= (m << 1 | 1); ++j) {
      if (j - a[i]) {
        f[t][j][0] = (f[t][j][0] + f[t ^ 1][j - a[i]][0]) % mod;
        f[t][j][1] = (f[t][j][1] + f[t ^ 1][j - a[i]][1]) % mod;
      }
      if (j + a[i] < (m + 1 << 1)) {
        f[t][j][0] = (f[t][j][0] + f[t ^ 1][j + a[i]][0]) % mod;
        f[t][j][1] = (f[t][j][1] + f[t ^ 1][j + a[i]][1]) % mod;
      }
      if (j - a[i] + 1)
        f[t][j][1] = (f[t][j][1] + f[t ^ 1][j - a[i] + 1][0]) % mod;
      if (j + a[i] - 1 < (m + 1 << 1))
        f[t][j][1] = (f[t][j][1] + f[t ^ 1][j + a[i] - 1][0]) % mod;
    }
  }
  ans = ((ans + f[t ^ 1][zero][0]) % mod + ((f[t ^ 1][zero][1] << 1) % mod)) %
        mod;
  printf("%lld\n", (ans + mod) % mod);
  return 0;
}
