#include <bits/stdc++.h>
using namespace std;
std::mt19937 rnd(
    (int)std::chrono::steady_clock::now().time_since_epoch().count());
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXN = 2000;
const int MOD = 1000000007;
void inc(int& a, int b) {
  if ((a += b) >= MOD) a -= MOD;
}
int n, m;
vector<int> adj[MAXN];
vector<int> cyc;
vector<int> todo[MAXN];
int solve() {
  assert(((int)(adj[0]).size()) % 2 == 0);
  for (int i = (1); i < (n); ++i) assert(((int)(adj[i]).size()) == 2);
  for (int i = (0); i < (n); ++i) todo[i] = adj[i];
  cyc.clear();
  while (((int)(todo[0]).size()) > 0) {
    int prv = 0, at = todo[0].back();
    todo[0].pop_back();
    int len = 1;
    while (true) {
      auto it = find(todo[at].begin(), todo[at].end(), prv);
      assert(it != todo[at].end());
      todo[at].erase(it);
      if (at == 0) break;
      int to = todo[at].back();
      todo[at].pop_back();
      ++len;
      prv = at, at = to;
    }
    cyc.push_back(len);
  }
  for (int i = (0); i < (n); ++i) assert(((int)(todo[i]).size()) == 0);
  int sum = 0;
  for (int i = (0); i < (((int)(cyc).size())); ++i) sum += cyc[i];
  assert(sum == m);
  vector<vector<int>> dp(4, vector<int>(2 * sum + 1, 0));
  inc(dp[0][sum + 0], 1);
  for (int i = (0); i < (((int)(cyc).size())); ++i) {
    int len = cyc[i];
    vector<vector<int>> ndp(4, vector<int>(2 * sum + 1, 0));
    for (int state = (0); state < (4); ++state)
      for (int bal = (-sum); bal <= (+sum); ++bal) {
        int ways = dp[state][sum + bal];
        if (ways == 0) continue;
        inc(ndp[state][sum + bal + len], ways);
        inc(ndp[state][sum + bal - len], ways);
        if (state != 3) inc(ndp[state == 0 ? 1 : state][sum + bal], ways);
        if (state < 2)
          for (int i = (1); i <= (len - 1); ++i)
            inc(ndp[2][sum + bal + i - (len - i)], (long long)2 * ways % MOD);
        if (state < 2)
          for (int i = (1); i <= (len - 2); ++i)
            inc(ndp[2][sum + bal + i - (len - i - 1)],
                (long long)2 * ways % MOD);
        if (state == 0)
          for (int i : {0, len - 1})
            inc(ndp[3][sum + bal + i - (len - i - 1)],
                (long long)2 * ways % MOD);
      }
    swap(dp, ndp);
  }
  int ret = 0;
  inc(ret, dp[0][sum + 0]);
  inc(ret, dp[2][sum + 0]);
  inc(ret, dp[3][sum + 0]);
  return ret;
}
void run() {
  scanf("%d%d", &n, &m);
  for (int i = (0); i < (m); ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a, --b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  printf("%d\n", solve());
}
int main() {
  run();
  return 0;
}
