#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e3 + 5;
int N, M, SA, SB, ans;
int P[MAXN];
int H[MAXN];
int DP[MAXN][3 * MAXN];
int PD[MAXN][3 * MAXN];
vector<int> A, B;
vector<int> V[MAXN];
set<int> S;
const long long MOD = 1e9 + 7, D = (1LL << 61) / MOD;
inline int add(int a) { return a < MOD ? a : a - MOD; }
inline int sub(int a) { return a < 0 ? a + MOD : a; }
inline int mul(long long a) { return add(a - MOD * ((a >> 29) * D >> 32)); }
int expo(long long a, int b) {
  return b ? b & 1 ? mul(a * expo(mul(a * a), b >> 1))
                   : expo(mul(a * a), b >> 1)
           : 1;
}
inline int div(int a) { return expo(a, MOD - 2); }
void input() {
  cin >> N >> M;
  for (int i = 0; i < M; i++) {
    int X, Y;
    cin >> X >> Y;
    V[X].push_back(Y);
    V[Y].push_back(X);
  }
  for (int X : V[1]) {
    int Y = 1, H = 1;
    while (X != 1) {
      Y = V[X][0] + V[X][1] - Y;
      swap(X, Y);
      H++;
    }
    B.push_back(H);
  }
}
void debug() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> M;
    B.push_back(M);
    B.push_back(M);
  }
}
int main() {
  input();
  sort(B.begin(), B.end());
  for (int i = 0; i < B.size(); i += 2) {
    if (S.count(B[i])) {
      A.push_back(B[i]);
    } else {
      S.insert(B[i]);
    }
  }
  SA = A.size();
  for (int x : S) {
    A.push_back(x);
  }
  SB = A.size();
  DP[0][0] = 1;
  for (int i = 0; i < SB; i++) {
    P[i + 1] = P[i] + A[i];
    for (int j = 0; j <= P[i + 1]; j++) {
      DP[i + 1][j] =
          add(DP[i][j > A[i] ? j - A[i] : A[i] - j] + DP[i][j + A[i]]);
      PD[i + 1][j] = add(
          add(DP[i][j > A[i] ? j - A[i] : A[i] - j] + PD[i][j + A[i]]) +
          (j >= A[i]
               ? PD[i][j - A[i]]
               : sub(mul((long long)i * DP[i][A[i] - j]) - PD[i][A[i] - j])));
    }
  }
  ans = add(DP[SB][0] + add(add(PD[SB][1] << 1) << 1));
  for (int i = 0; i < SB; i++) {
    for (int j = 0; j <= P[i + 1]; j++) {
      DP[i + 1][j] = add(DP[i][j] + add(DP[i][j > A[i] ? j - A[i] : A[i] - j] +
                                        DP[i][j + A[i]]));
    }
  }
  for (int h = SB - 1; h >= SA; h--) {
    for (int i = h + 1; i < SB; i++) {
      for (int j = 0; j <= P[i + 1]; j++) {
        DP[i][j] =
            add(DP[i - 1][j] + add(DP[i - 1][j > A[i] ? j - A[i] : A[i] - j] +
                                   DP[i - 1][j + A[i]]));
      }
    }
    for (int i = 1; i < A[h] - 1; i++) {
      H[A[h]] = add(H[A[h]] + DP[SB - 1][i]);
    }
    H[A[h]] = add(H[A[h]] << 1);
    H[A[h]] = add(H[A[h]] + DP[SB - 1][0]);
    H[A[h]] = add(H[A[h]] << 1);
  }
  for (int i = 0; i < SB; i++) {
    ans = add(ans + H[A[i]]);
  }
  cout << ans << '\n';
}
