#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int now = 0, f = 1;
  char c = getchar();
  for (; !isdigit(c); c == '-' && (f = -1), c = getchar())
    ;
  for (; isdigit(c); now = now * 10 + c - 48, c = getchar())
    ;
  return now * f;
}
const int mod = 1e9 + 7;
inline int add(int a, int b) { return a + b >= mod ? a + b - mod : a + b; }
inline int sub(int a, int b) { return a < b ? a - b + mod : a - b; }
inline int mul(int a, int b) { return 1LL * a * b % mod; }
int qpow(int a, int b) {
  int ret = 1;
  for (; b; b >>= 1) {
    if (b & 1) ret = mul(ret, a);
    a = mul(a, a);
  }
  return ret;
}
inline int rev(int x) { return qpow(x, mod - 2); }
const int N = 2e3 + 10;
const int M = 4e3 + 10;
vector<int> es[N];
int v[N];
int dfs(int x) {
  v[x] = 1;
  for (auto &y : es[x]) {
    if (v[y]) continue;
    return dfs(y) + 1;
  }
  return 1;
}
int n, m, a[N];
int f[N][2 * N + 5][5];
const int Base = N;
inline int valid(int x) { return abs(x - Base) <= m / 2; }
int main() {
  n = read(), m = read();
  for (int i = 1; i <= m; i++) {
    int u = read(), v = read();
    es[u].push_back(v);
    es[v].push_back(u);
  }
  memset(v, 0, sizeof(v));
  v[1] = 1;
  int num = 0;
  for (auto &x : es[1]) {
    if (v[x]) continue;
    a[++num] = dfs(x) + 1;
  }
  memset(f, 0, sizeof(f));
  f[0][Base][0] = 1;
  f[0][Base][3] = 1;
  for (int i = 1; i <= num; i++) {
    for (int j = -m + Base; j <= m + Base; ++j) {
      for (int t = 0; t < 5; t++) {
        if (valid(j - a[i]))
          f[i][j - a[i]][t] = add(f[i][j - a[i]][t], f[i - 1][j][t]);
        if (valid(j + a[i]))
          f[i][j + a[i]][t] = add(f[i][j + a[i]][t], f[i - 1][j][t]);
        if (t < 3)
          if (valid(j)) f[i][j][t] = add(f[i][j][t], f[i - 1][j][t]);
      }
      for (int k = 1; k < a[i]; k++) {
        if (valid(j + k - (a[i] - k)))
          f[i][j + k - (a[i] - k)][1] =
              add(f[i][j + k - (a[i] - k)][1], mul(2, f[i - 1][j][0]));
      }
      for (int k = 1; k < a[i] - 1; k++) {
        if (valid(j + k - (a[i] - k - 1)))
          f[i][j + k - (a[i] - k - 1)][2] =
              add(f[i][j + k - (a[i] - k - 1)][2], mul(2, f[i - 1][j][0]));
      }
      if (valid(j + (a[i] - 1)))
        f[i][j + (a[i] - 1)][4] =
            add(f[i][j + (a[i] - 1)][4], mul(2, f[i - 1][j][3]));
      if (valid(j - (a[i] - 1)))
        f[i][j - (a[i] - 1)][4] =
            add(f[i][j - (a[i] - 1)][4], mul(2, f[i - 1][j][3]));
    }
  }
  int ans = 0;
  for (int t = 1; t < 5; t++) ans = add(ans, f[num][Base][t]);
  printf("%d\n", ans);
  return 0;
}
