#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
vector<int> val;
int memo[2005][4005][3][2];
int dp(int pos, int selisih, int finish, bool skipped) {
  if (pos == val.size()) {
    if (selisih == 2000 && finish == 2) {
      return 1;
    }
    if (selisih == 2000 && finish != 2 && !skipped) {
      return 1;
    }
    return 0;
  }
  int &ret = memo[pos][selisih][finish][skipped];
  if (ret == -1) {
    ret = 0;
    ret = (ret + dp(pos + 1, selisih + val[pos], finish, skipped)) % mod;
    ret = (ret + dp(pos + 1, selisih - val[pos], finish, skipped)) % mod;
    ret = (ret + dp(pos + 1, selisih, finish, true)) % mod;
    if (!finish) {
      for (int i = 1; i < val[pos]; i++) {
        ret = (ret + (2 * dp(pos + 1, selisih - i + val[pos] - i, 2, skipped)) %
                         mod) %
              mod;
        if (i > 1)
          ret = (ret +
                 (2 * dp(pos + 1, selisih - i + 1 + val[pos] - i, 2, skipped)) %
                     mod) %
                mod;
      }
      ret =
          (ret + (2 * dp(pos + 1, selisih + val[pos] - 1, 1, skipped)) % mod) %
          mod;
      ret =
          (ret + (2 * dp(pos + 1, selisih - val[pos] + 1, 1, skipped)) % mod) %
          mod;
    }
  }
  return ret;
}
vector<int> adjList[2005];
bool vis[2005];
int dfs(int pos) {
  int sz = adjList[pos].size();
  for (int i = 0; i < sz; i++) {
    int x = adjList[pos][i];
    if (!vis[x]) {
      vis[x] = true;
      return dfs(x) + 1;
    }
  }
  return 1;
}
int main() {
  memset(memo, -1, sizeof memo);
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    b--;
    if (b > 0) adjList[a].push_back(b);
    if (a > 0) adjList[b].push_back(a);
  }
  int sz = adjList[0].size();
  for (int i = 0; i < sz; i++) {
    int x = adjList[0][i];
    if (!vis[x]) {
      vis[x] = true;
      int tmp = dfs(x) + 1;
      val.push_back(tmp);
    }
  }
  printf("%d\n", dp(0, 2000, false, false));
}
