#include <bits/stdc++.h>
const int inf = 0x3f3f3f3f;
using namespace std;
template <typename T = int>
T yh() {
  T ret = 0;
  bool f = 0;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == EOF) return -1;
    if (c == '-') f = 1;
    c = getchar();
  }
  while (isdigit(c)) ret = (ret << 3) + (ret << 1) + (c ^ 48), c = getchar();
  return f ? -ret : ret;
}
template <typename T>
void yh(T& ret) {
  ret = 0;
  bool f = 0;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == EOF) return ret = -1, void();
    if (c == '-') f = 1;
    c = getchar();
  }
  while (isdigit(c)) ret = (ret << 3) + (ret << 1) + (c ^ 48), c = getchar();
  ret = f ? -ret : ret;
}
const int maxn = 2005, mod = 1e9 + 7;
map<int, int> cycles;
vector<int> a;
long long dp[2005][4010][2];
bool vis[maxn];
vector<int> adj[maxn];
int n, m;
int stoploopsize = 0;
long long solve(int pos, int diff, bool takeAll) {
  if (pos == (int)a.size()) {
    if (takeAll)
      return diff == max((int)0, stoploopsize - 1);
    else
      return diff < stoploopsize - 1;
  }
  long long& ans = dp[pos][diff][takeAll];
  if (~ans) return ans;
  ans = 0;
  ans += solve(pos + 1, diff + a[pos], takeAll);
  ans += solve(pos + 1, abs(diff - a[pos]), takeAll);
  ans %= mod;
  if (takeAll == 0) ans += solve(pos + 1, diff, takeAll);
  return ans % mod;
}
long long calc(int siz, bool takeAll) {
  memset(dp, -1, sizeof(dp));
  a.clear();
  if (siz > 0) cycles[siz]--;
  for (auto p : cycles) {
    for (register int __ = (1); __ <= (p.second); __++) a.push_back(p.first);
  }
  if (siz > 0) cycles[siz]++;
  stoploopsize = siz;
  long long ans = 0;
  if (takeAll == 0) ans += solve(0, 0, 0);
  ans += solve(0, 0, 1);
  return ans % mod;
}
signed main() {
  n = yh(), m = yh();
  for (register int i = (1); i <= (m); i++) {
    int x = yh(), y = yh();
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  for (auto y : adj[1])
    if (!vis[y]) {
      int yn = y, yo = 1;
      int sz = 0;
      if (adj[yn][0] == adj[yn][1]) {
        vis[yn] = 1;
        cycles[2]++;
        continue;
      }
      while (yn != 1) {
        vis[yn] = 1;
        sz++;
        for (auto ynn : adj[yn]) {
          if (ynn != yo) {
            yo = yn, yn = ynn;
            break;
          }
        }
      }
      cycles[sz + 1]++;
    }
  long long ans = 0;
  for (auto p : cycles) {
    ans = (ans + 2ll * p.second * calc(p.first, 0) % mod) % mod;
  }
  ans += calc(0, 1) % mod;
  cout << ans % mod;
  return 0;
}
