#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long INF = (long long)1000000007 * 1000000007;
const long double eps = 1e-8;
const long double pi = acos(-1.0);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <int mod>
struct ModInt {
  long long x;
  ModInt() : x(0) {}
  ModInt(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
  explicit operator int() const { return x; }
  ModInt &operator+=(const ModInt &p) {
    if ((x += p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator-=(const ModInt &p) {
    if ((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator*=(const ModInt &p) {
    x = (int)(1LL * x * p.x % mod);
    return *this;
  }
  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }
  ModInt operator-() const { return ModInt(-x); }
  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
  bool operator==(const ModInt &p) const { return x == p.x; }
  bool operator!=(const ModInt &p) const { return x != p.x; }
  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while (b > 0) {
      t = a / b;
      a -= t * b;
      swap(a, b);
      u -= t * v;
      swap(u, v);
    }
    return ModInt(u);
  }
  ModInt power(long long p) const {
    int a = x;
    if (p == 0) return 1;
    if (p == 1) return ModInt(a);
    if (p % 2 == 1)
      return (ModInt(a) * ModInt(a)).power(p / 2) * ModInt(a);
    else
      return (ModInt(a) * ModInt(a)).power(p / 2);
  }
  ModInt power(const ModInt p) const { return ((ModInt)x).power(p.x); }
  friend ostream &operator<<(ostream &os, const ModInt<mod> &p) {
    return os << p.x;
  }
  friend istream &operator>>(istream &is, ModInt<mod> &a) {
    long long x;
    is >> x;
    a = ModInt<mod>(x);
    return (is);
  }
};
using modint = ModInt<mod>;
int n, m, N;
vector<int> a;
vector<int> G[2010];
bool visited[2010], calced[2010];
modint Z[2010];
void dfs(int s, int par, int d) {
  visited[s] = true;
  if (G[s][0] == 0 && G[s][1] == 0) {
    a.push_back(2);
    return;
  }
  for (int t : G[s]) {
    if (t == par) continue;
    if (t == 0) {
      a.push_back(d + 1);
      return;
    }
    dfs(t, s, d + 1);
  }
}
modint calc(int c) {
  if (c != -1)
    if (calced[a[c]]) return Z[a[c]];
  vector<vector<vector<modint>>> dp(
      2, vector<vector<modint>>(2 * m + 1, vector<modint>(2, 0)));
  dp[0][m][1] = 1;
  for (int i = 0; i < N; i++) {
    for (int diff = 0; diff < 2 * m + 1; diff++) {
      dp[(i + 1) % 2][diff][0] = 0;
      dp[(i + 1) % 2][diff][1] = 0;
    }
    for (int diff = 0; diff < 2 * m + 1; diff++) {
      if (i == c) {
        dp[(i + 1) % 2][diff][0] = dp[i % 2][diff][0];
        dp[(i + 1) % 2][diff][1] = dp[i % 2][diff][1];
        continue;
      }
      dp[(i + 1) % 2][diff][0] += dp[i % 2][diff][0] + dp[i % 2][diff][1];
      if (diff + a[i] <= 2 * m) {
        dp[(i + 1) % 2][diff + a[i]][0] += dp[i % 2][diff][0];
        dp[(i + 1) % 2][diff + a[i]][1] += dp[i % 2][diff][1];
      }
      if (diff - a[i] >= 0) {
        dp[(i + 1) % 2][diff - a[i]][0] += dp[i % 2][diff][0];
        dp[(i + 1) % 2][diff - a[i]][1] += dp[i % 2][diff][1];
      }
    }
  }
  if (c == -1) {
    return dp[N % 2][m][1];
  }
  modint res =
      (modint)2 * (dp[N % 2][a[c] - 1 + m][1] + dp[N % 2][-(a[c] - 1) + m][1]);
  for (int i = 1; i < a[c] - 1; i++) {
    res += (modint)2 * (dp[N % 2][i + m][1] + dp[N % 2][i + m][0]);
    res += (modint)2 * (dp[N % 2][-i + m][1] + dp[N % 2][-i + m][0]);
  }
  res += (modint)2 * (dp[N % 2][m][1] + dp[N % 2][m][0]);
  Z[a[c]] = res;
  calced[a[c]] = true;
  return res;
}
void solve() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  for (int t : G[0]) {
    if (visited[t]) continue;
    dfs(t, 0, 1);
  }
  N = a.size();
  sort(a.begin(), a.end());
  modint ans = 0;
  for (int i = 0; i < N; i++) {
    ans += calc(i);
  }
  ans += calc(-1);
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(50);
  solve();
}
