#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long n, m, k, t, x, y, l, r, ans, cnt;
long long a[2010], c[2010], fa[2010], f[2][8010][2];
inline long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + (c ^ '0');
    c = getchar();
  }
  return x * f;
}
inline long long find(long long x) {
  return fa[x] == x ? x : fa[x] = find(fa[x]);
}
int main() {
  n = read();
  m = read();
  for (long long i = 1; i <= n; i++) {
    fa[i] = i;
    c[i] = 1;
  }
  for (long long i = 1; i <= m; i++) {
    x = find(read());
    y = find(read());
    if (x == 1 || y == 1 || x == y) continue;
    fa[y] = x;
    c[x] += c[y];
  }
  for (long long i = 2; i <= n; i++)
    if (fa[i] == i) a[++cnt] = c[i] + 1;
  k = m + 1;
  t = 1;
  f[0][k][0] = 1;
  for (long long i = 1; i <= cnt; i++, t ^= 1) {
    for (long long j = 1; j <= (m << 1) + 1; j++) {
      f[t][j][0] = f[t ^ 1][j][0];
      f[t][j][1] = f[t ^ 1][j][1];
    }
    for (long long j = 1; j <= (m << 1) + 1; j++) {
      if (j - a[i] > 0) {
        f[t][j][0] = (f[t][j][0] + f[t ^ 1][j - a[i]][0]) % mod;
        f[t][j][1] = (f[t][j][1] + f[t ^ 1][j - a[i]][1]) % mod;
      }
      if (j + a[i] < (m + 1) << 1) {
        f[t][j][0] = (f[t][j][0] + f[t ^ 1][j + a[i]][0]) % mod;
        f[t][j][1] = (f[t][j][1] + f[t ^ 1][j + a[i]][1]) % mod;
      }
    }
    for (long long j = 1; j <= (m << 1) + 1; j++)
      f[t ^ 1][j][0] = (f[t ^ 1][j][0] + f[t ^ 1][j - 1][0]) % mod;
    for (long long j = 1; j <= (m << 1) + 1; j++) {
      l = max(1ll, j - a[i] + 2);
      r = min(j + a[i] - 2, (m << 1) + 1);
      f[t][j][1] =
          (f[t][j][1] + (f[t ^ 1][r][0] - f[t ^ 1][l - 1][0] + mod) % mod) %
          mod;
    }
  }
  ans = (f[t ^ 1][k][1] + f[t ^ 1][k][1]) % mod;
  for (long long j = 1; j <= (m << 1) + 1; j++)
    f[t][j][0] = f[t ^ 1][j][0] = f[t][j][1] = f[t ^ 1][j][1] = 0;
  f[t ^ 1][k][0] = 1;
  for (long long i = 1; i <= cnt; i++, t ^= 1) {
    for (long long j = 1; j <= (m << 1) + 1; j++) f[t][j][0] = f[t][j][1] = 0;
    for (long long j = 1; j <= (m << 1) + 1; j++) {
      if (j - a[i] > 0) {
        f[t][j][0] = (f[t][j][0] + f[t ^ 1][j - a[i]][0]) % mod;
        f[t][j][1] = (f[t][j][1] + f[t ^ 1][j - a[i]][1]) % mod;
      }
      if (j + a[i] < (m + 1) << 1) {
        f[t][j][0] = (f[t][j][0] + f[t ^ 1][j + a[i]][0]) % mod;
        f[t][j][1] = (f[t][j][1] + f[t ^ 1][j + a[i]][1]) % mod;
      }
      if (j - a[i] + 1 > 0)
        f[t][j][1] = (f[t][j][1] + f[t ^ 1][j - a[i] + 1][0]) % mod;
      if (j + a[i] - 1 < (m + 1) << 1)
        f[t][j][1] = (f[t][j][1] + f[t ^ 1][j + a[i] - 1][0]) % mod;
    }
  }
  ans = (ans + f[t ^ 1][k][0]) % mod;
  ans = (ans + (f[t ^ 1][k][1] + f[t ^ 1][k][1]) % mod) % mod;
  printf("%lld", ans);
  return 0;
}
