#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
using ll = long long;
using ld = long double;
ll MOD = 1000000007;
const ll root = 3;
ll binpow(ll a, ll b) {
  ll res = 1;
  while (b) {
    if (b & 1) res = (res * a) % MOD;
    a = (a * a) % MOD;
    b >>= 1;
  }
  return res;
}
ll modInv(ll a) { return binpow(a, MOD - 2); }
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll NINFLL = 0xc0c0c0c0c0c0c0c0;
const int mxN = 2001;
int n, m;
bool done[mxN];
int dsu[mxN];
int sz[mxN];
ll dp[2 * mxN][4];
ll dp_prv[2 * mxN][4];
vector<int> adj;
int find(int a) { return a == dsu[a] ? a : dsu[a] = find(dsu[a]); }
bool merge(int a, int b) {
  a = find(a);
  b = find(b);
  if (a == b) return 0;
  sz[a] += sz[b];
  dsu[b] = a;
  return 1;
}
int main() {
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  cin.tie(0)->sync_with_stdio(0);
  cin >> n >> m;
  for (int i = (0); i < (mxN); ++i) sz[i] = 1;
  iota(dsu, dsu + mxN, 0);
  for (int i = (0); i < (m); ++i) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    if (a == 0 || b == 0) {
      adj.push_back(a ^ b);
    } else {
      merge(a, b);
    }
  }
  int sum = 0;
  vector<int> arr;
  for (int k : adj) {
    if (!done[find(k)]) {
      arr.push_back(sz[find(k)]);
      done[find(k)] = 1;
    }
  }
  int nn = arr.size();
  dp_prv[mxN][0] = 1;
  dp_prv[mxN][1] = 1;
  for (int i = (0); i < (nn); ++i) {
    memset(dp, 0, sizeof(dp));
    for (int j = (0); j < (2 * mxN); ++j) {
      for (int k = (0); k < (4); ++k) {
        if (j + arr[i] + 1 < 2 * mxN) {
          dp[j + arr[i] + 1][k] = (dp[j + arr[i] + 1][k] + dp_prv[j][k]) % MOD;
        }
        if (j - arr[i] - 1 >= 0) {
          dp[j - arr[i] - 1][k] = (dp[j - arr[i] - 1][k] + dp_prv[j][k]) % MOD;
        }
      }
      dp[j][0] = (dp[j][0] + dp_prv[j][0]);
      dp[j][2] = (dp[j][2] + dp_prv[j][2]);
      for (int num = (0); num < (arr[i] + 1); ++num) {
        int oth = arr[i] - num + 1;
        if (num && j + num - oth >= 0 && j + num - oth < 2 * mxN)
          dp[j + num - oth][2] =
              (dp[j + num - oth][2] + dp_prv[j][0] * 2LL) % MOD;
        oth--;
        if (j + num - oth >= 0 && j + num - oth < 2 * mxN) {
          if (num == 0 || oth == 0) {
            dp[j + num - oth][3] =
                (dp[j + num - oth][3] + dp_prv[j][1] * 2LL) % MOD;
          } else {
            dp[j + num - oth][2] =
                (dp[j + num - oth][2] + dp_prv[j][0] * 2LL) % MOD;
          }
        }
      }
    }
    swap(dp, dp_prv);
  }
  ll res = (dp_prv[mxN][2] + dp_prv[mxN][3] + dp_prv[mxN][1]) % MOD;
  cout << res << "\n";
  return 0;
}
