#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 5;
const long long mod = 1e9 + 7;
int dp[N][N * 2][5];
int a[N], cnt, tot, vis[N];
vector<int> son[N];
void dfs(int x) {
  vis[x] = 1;
  cnt++;
  for (int i : son[x]) {
    if (vis[i]) continue;
    dfs(i);
  }
}
int main() {
  int n, N, x, y;
  scanf("%d%d", &n, &N);
  for (int i = 1; i <= N; i++)
    scanf("%d%d", &x, &y), son[x].push_back(y), son[y].push_back(x);
  vis[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (!vis[i]) {
      cnt = 0;
      dfs(i);
      a[++tot] = cnt + 1;
    }
  }
  dp[0][N][0] = 1;
  dp[0][N][3] = 1;
  int mx = 0;
  for (int i = 1; i <= tot; i++) {
    for (int j = -mx; j <= mx; j++) {
      dp[i][j + a[i] + N][0] =
          (1ll * dp[i][j + a[i] + N][0] + dp[i - 1][j + N][0]) % mod;
      dp[i][j - a[i] + N][0] =
          (1ll * dp[i][j - a[i] + N][0] + dp[i - 1][j + N][0]) % mod;
      dp[i][j + N][0] = (dp[i][j + N][0] + dp[i - 1][j + N][0]) % mod;
      dp[i][j + a[i] + N][1] =
          (1ll * dp[i][j + a[i] + N][1] + dp[i - 1][j + N][1]) % mod;
      dp[i][j - a[i] + N][1] =
          (1ll * dp[i][j - a[i] + N][1] + dp[i - 1][j + N][1]) % mod;
      dp[i][j + N][1] = (1ll * dp[i][j + N][1] + dp[i - 1][j + N][1]) % mod;
      dp[i][j + a[i] + N][2] =
          (1ll * dp[i][j + a[i] + N][2] + dp[i - 1][j + N][2]) % mod;
      dp[i][j - a[i] + N][2] =
          (1ll * dp[i][j - a[i] + N][2] + dp[i - 1][j + N][2]) % mod;
      dp[i][j + N][2] = (1ll * dp[i][j + N][2] + dp[i - 1][j + N][2]) % mod;
      for (int k = 1; k < a[i]; k++)
        dp[i][j + k - (a[i] - k) + N][1] =
            (1ll * dp[i][j + k - (a[i] - k) + N][1] +
             2ll * dp[i - 1][j + N][0]) %
            mod;
      for (int k = 1; k < a[i] - 1; k++)
        dp[i][j + k - (a[i] - 1 - k) + N][2] =
            (1ll * dp[i][j + k - (a[i] - 1 - k) + N][2] +
             2ll * dp[i - 1][j + N][0]) %
            mod;
      dp[i][j + a[i] + N][3] =
          (1ll * dp[i][j + a[i] + N][3] + dp[i - 1][j + N][3]) % mod;
      dp[i][j - a[i] + N][3] =
          (1ll * dp[i][j - a[i] + N][3] + dp[i - 1][j + N][3]) % mod;
      dp[i][j + a[i] + N][4] =
          (1ll * dp[i][j + a[i] + N][4] + dp[i - 1][j + N][4]) % mod;
      dp[i][j - a[i] + N][4] =
          (1ll * dp[i][j - a[i] + N][4] + dp[i - 1][j + N][4]) % mod;
      dp[i][j + a[i] - 1 + N][4] =
          (1ll * dp[i][j + a[i] - 1 + N][4] + 2ll * dp[i - 1][j + N][3]) % mod;
      dp[i][j - a[i] + 1 + N][4] =
          (1ll * dp[i][j - a[i] + 1 + N][4] + 2ll * dp[i - 1][j + N][3]) % mod;
    }
    mx += a[i];
  }
  printf("%lld\n",
         (1ll * dp[tot][N][1] + dp[tot][N][2] + dp[tot][N][3] + dp[tot][N][4]) %
             mod);
  return 0;
}
