#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void ckmax(T& x, T y) {
  x = (y > x ? y : x);
}
template <typename T>
inline void ckmin(T& x, T y) {
  x = (y < x ? y : x);
}
const int MAXN = 2000;
const int MOD = 1e9 + 7;
inline int mod1(int x) { return x < MOD ? x : x - MOD; }
inline int mod2(int x) { return x < 0 ? x + MOD : x; }
inline void add(int& x, int y) { x = mod1(x + y); }
inline void sub(int& x, int y) { x = mod2(x - y); }
int n, m;
vector<int> G[MAXN + 5];
int cir[MAXN + 5];
int a[MAXN + 5], cnt;
int dp[MAXN + 5][MAXN * 4 + 5][2];
int calc_dp(int len) {
  cnt = 0;
  int sum = 0;
  for (int i = 2; i <= n; ++i) {
    for (int j = 1; j <= cir[i] - (i == len); ++j) {
      a[++cnt] = i;
      sum += i;
    }
  }
  for (int i = 0; i <= cnt; ++i) {
    for (int j = -sum; j <= sum; ++j) {
      for (int k = 0; k <= 1; ++k) {
        dp[i][j + sum][k] = 0;
      }
    }
  }
  dp[0][0 + sum][1] = 1;
  for (int i = 1; i <= cnt; ++i) {
    for (int j = -sum; j <= sum; ++j) {
      for (int k = 0; k <= 1; ++k)
        if (dp[i - 1][j + sum][k]) {
          assert(j + a[i] <= sum);
          add(dp[i][j + a[i] + sum][k], dp[i - 1][j + sum][k]);
          assert(j - a[i] >= -sum);
          add(dp[i][j - a[i] + sum][k], dp[i - 1][j + sum][k]);
          add(dp[i][j + sum][0], dp[i - 1][j + sum][k]);
        }
    }
  }
  if (!len) {
    return dp[cnt][0 + sum][1];
  }
  int res = 0;
  for (int i = 1; i < len; ++i) {
    int dif = (len - i) - i;
    if (abs(dif) > sum) continue;
    add(res, dp[cnt][dif + sum][0]);
    add(res, dp[cnt][dif + sum][1]);
  }
  for (int i = 0; i < len; ++i) {
    int dif = (len - i - 1) - i;
    if (abs(dif) > sum) continue;
    if (i != 0 && i != len - 1) add(res, dp[cnt][dif + sum][0]);
    add(res, dp[cnt][dif + sum][1]);
  }
  res = res * 2 % MOD;
  return res;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= m; ++i) {
    int u, v;
    cin >> u >> v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  static bool vis[MAXN + 5];
  for (int i = 0; i < ((int)(G[1]).size()); ++i) {
    int u = G[1][i];
    if (vis[u]) {
      continue;
    }
    int len = 1;
    int lst = 1;
    while (u != 1) {
      len++;
      vis[u] = 1;
      int nxt_u = (G[u][0] ^ G[u][1] ^ lst);
      lst = u;
      u = nxt_u;
    }
    cir[len]++;
  }
  int ans = 0;
  for (int i = 2; i <= n; ++i) {
    if (cir[i]) {
      add(ans, (long long)calc_dp(i) * cir[i] % MOD);
    }
  }
  add(ans, calc_dp(0));
  cout << ans << endl;
  return 0;
}
