#include<bits/stdc++.h>
using namespace std;
int head[600000],vet[2000100],net[2000100],lun;
void nb(int x,int y){
	vet[++lun]=y;
	net[lun]=head[x];
	head[x]=lun;
}
int p=1e9+7;
int ksm(int a,int b){
	if(b<=0)return 1;
	int ans=1,sum=a;
	while(b){
		if(b&1)
			ans=1LL*ans*sum%p;
		sum=1LL*sum*sum%p;
		b/=2;
	}
	return ans;
}
int ans=0;
int f[2000100][2];
void so(int x,int fa){
	f[x][0]=f[x][1]=1;
	for(int e=head[x];e;e=net[e]){
		int y=vet[e];
		if(y!=fa) so(y,x);
		f[x][0]=(1LL*f[x][0]*f[y][0]%p*2%p);
		f[x][1]=(1LL*f[x][1]*((f[y][0]*2%p+f[y][1])%p));
	}
	f[x][1]=(f[x][1]-f[x][0]+p)%p;
}
int main(){
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	int n,m;
	scanf("%d%d",&n,&m);
		for(int i=1;i<=m;i++){
			int x,y;
			scanf("%d%d",&x,&y);
			nb(x,y);
			nb(y,x);
		}
	so(1,0);
	printf("%d",(f[1][0]+f[1][1])%p);
	return 0;
}