#include<bits/stdc++.h>
#define endl '\n'
#define fir first
#define sec second
#define ri register
#define pb push_back
#define mp make_pair
#define int long long
#define inf 2147483647
#define Swap(x,y) ((x)^=(y)^=(x)^=(y))
#define reset(x,y) memset((x),(y),sizeof((x)))
#define fastcin ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
/* May all the beauty be blessed. */
using namespace std;
inline int read()
{
	ri int x=0,f=0;ri 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 f?-x:x;
}
inline void write(int x)
{
	if(x<0) putchar('-'),x=-x;
	if(x>9) write(x/10);
	putchar(x%10+'0');
}
const int N=1e6+10,mod=1e9+7;
int Head[N],Next[N<<1],To[N<<1],Cnt,head[N],nxt[N<<1],to[N<<1],cnt;
inline void Add(int x,int y) {Next[++Cnt]=Head[x],Head[x]=Cnt,To[Cnt]=y;}
inline void add(int x,int y) {nxt[++cnt]=head[x],head[x]=cnt,to[cnt]=y;}
int n,m,ans,x[N],y[N],tag[N],vis[N],a[N],f[N],flag1=1,tmp[N],fa[N],res;
map<pair<int,int>,int> used,v;
inline int Pow(int a,int b,int ans=1) {while(b) (b&1)&&(ans=ans*a%mod),a=a*a%mod,b>>=1;return ans;}
inline void Bfs()
{
	queue<int> Q;Q.push(vis[1]=1);
	while(!Q.empty())
	{
		ri int x=Q.front();Q.pop();
		for(ri int i=Head[x],y;i;i=Next[i])
			if(!vis[y=To[i]]) vis[y]=1,Q.push(y);
	}
}
inline void BFS(int s,int t)
{
	queue<int> Q;Q.push(vis[s]=1),a[s]=t;
	while(!Q.empty())
	{
		ri int x=Q.front();Q.pop();
		for(ri int i=Head[x],y;i;i=Next[i])
			if(!vis[y=To[i]]) vis[y]=1,a[y]=t,Q.push(y);
	}
}
inline void DFS(int x,int fath)
{
	fa[x]=fath;
	for(ri int i=head[x],y;i;i=nxt[i])
		if((y=to[i])!=fath) DFS(y,x);
}
inline void Calc(int flag=0,int lst=0)
{
	for(ri int i=1;i<=n;++i)
	{
		if(f[i]) flag=1;
		tmp[i]=fa[i]=0;
	}
	if(!flag) return;
	for(ri int i=1;i<=n;++i)
		if(f[i]) tmp[a[i]]=1,lst=a[i];
	DFS(lst,res=0),v.clear();
	for(ri int i=1;i<=n;++i)
		if(f[i])
		{
			ri int tmp1=a[i];
			while(tmp1!=lst)
			{
				if(!v[mp(tmp1,fa[tmp1])]) ++res,v[mp(tmp1,fa[tmp1])]=v[mp(fa[tmp1],tmp1)]=1;
				tmp1=fa[tmp1];
			}
		}
	ans=(ans+Pow(2,m-res))%mod;
}
inline void Dfs(int x) {if(x>n) return void(Calc());f[x]=1,Dfs(x+1),f[x]=0,Dfs(x+1);}
signed main()
{
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	n=read(),m=read();
	for(ri int i=1;i<=m;++i)
	{
		x[i]=read(),y[i]=read();
		if(!(x[i]==i&&y[i]==i+1||x[i]==i+1&&y[i]==i)) flag1=0;
	}
	if(flag1)
	{
		for(ri int i=1;i<=n;++i)
			ans=(ans+(n-i+1)*Pow(2,n-i)%mod*Pow(2,max(0ll,i-2))%mod)%mod;
		return cout<<ans,0;
	}
	for(ri int i=1;i<=m;++i)
	{
		for(ri int j=1;j<=m;++j)
			if(j!=i) Add(x[j],y[j]),Add(y[j],x[j]);
		Bfs();
		for(ri int j=1;j<=n;++j)
			if(!vis[j]) {tag[i]=1;break;}
		for(ri int j=1;j<=n;++j)
			Head[j]=vis[j]=Cnt=0;
	}
	for(ri int i=1;i<=m;++i)
		if(!tag[i]) Add(x[i],y[i]),Add(y[i],x[i]);
	for(ri int i=1,t=1;i<=n;++i)
		if(!vis[i]) BFS(i,t),++t;
	for(ri int i=1;i<=m;++i)
		if(tag[i]&&!used[mp(a[x[i]],a[y[i]])])
			add(a[x[i]],a[y[i]]),add(a[y[i]],a[x[i]]),used[mp(a[x[i]],a[y[i]])]=used[mp(a[y[i]],a[x[i]])]=1;
	return Dfs(1),cout<<ans,0;
}
//O(?) 45pts(?)
