#include <bits/stdc++.h>
const int maxn = 2e3 + 5;
const int mo = 1e9 + 7;
using namespace std;
int rd() {
  int x = 0, f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) x = (x << 3) + (x << 1) + c - '0', c = getchar();
  return x * f;
}
void add(int &x, int y) {
  x += y;
  if (x >= mo) x -= mo;
}
int n, m, fa[maxn], sz[maxn], cnt, b[maxn];
int f[maxn][maxn << 1][4];
int lst[maxn], top;
int find(int x) { return (fa[x] == x) ? x : fa[x] = find(fa[x]); }
void merge(int x, int y) {
  int fx = find(x), fy = find(y);
  if (fx == fy) return;
  fa[fx] = fy;
  sz[fy] += sz[fx];
}
int main() {
  n = rd();
  m = rd();
  for (int i = 1; i <= n; i++) fa[i] = i, sz[i] = 1;
  for (int u, v, i = 1; i <= m; i++) {
    u = rd();
    v = rd();
    if (u != 1 && v != 1) merge(u, v);
  }
  for (int i = 2; i <= n; i++)
    if (find(i) == i) lst[++top] = sz[i] + 1;
  int mx = 0;
  f[0][m][0] = f[0][m][2] = 1;
  for (int i = 1; i <= top; i++) {
    for (int j = -mx; j <= mx; j++) {
      add(f[i][j + m + lst[i]][0], f[i - 1][j + m][0]);
      add(f[i][j + m - lst[i]][0], f[i - 1][j + m][0]);
      add(f[i][j + m][0], f[i - 1][j + m][0]);
      add(f[i][j + m + lst[i]][1], f[i - 1][j + m][1]);
      add(f[i][j + m - lst[i]][1], f[i - 1][j + m][1]);
      add(f[i][j + m][1], f[i - 1][j + m][1]);
      for (int k = 1; k < lst[i]; k++)
        add(f[i][j + k - (lst[i] - k) + m][1], 2LL * f[i - 1][j + m][0] % mo);
      for (int k = 1; k < lst[i] - 1; k++)
        add(f[i][j + k - (lst[i] - k - 1) + m][1],
            2LL * f[i - 1][j + m][0] % mo);
      add(f[i][j + lst[i] + m][2], f[i - 1][j + m][2]);
      add(f[i][j - lst[i] + m][2], f[i - 1][j + m][2]);
      add(f[i][j + lst[i] + m][3], f[i - 1][j + m][3]);
      add(f[i][j - lst[i] + m][3], f[i - 1][j + m][3]);
      add(f[i][j + lst[i] - 1 + m][3], 2LL * f[i - 1][j + m][2] % mo);
      add(f[i][j - lst[i] + 1 + m][3], 2LL * f[i - 1][j + m][2] % mo);
    }
    mx += lst[i];
  }
  int ans = ((f[top][m][1] + f[top][m][2]) % mo + f[top][m][3]) % mo;
  printf("%d\n", ans);
  return 0;
}
