#include <iostream>
#include <vector>
using namespace std;

typedef long long ll;
ll _MOD = 1000000009;

struct union_find {
	vector<int> v;
	union_find(int n) : v(n, -1) {}
	int find(int x) { return (v[x] < 0) ? x : (v[x] = find(v[x])); }
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x != y) {
			if (-v[x] < -v[y]) swap(x, y);
			v[x] += v[y]; v[y] = x;
		}
	}
	bool same(int x, int y) { return find(x) == find(y); }
	int size(int x) { return -v[find(x)]; }
};

int main() {
	int n, m; cin >> n >> m;
	vector<int> a(m), b(m);
	for (int i = 0; i < m; i++) {
		scanf("%d%d", &a[i], &b[i]);
		a[i]--;
		b[i]--;
	}
	vector<bool> rm(n);
	for (;;) {
		vector<int> d(n);
		union_find uf(n);
		for (int i = 0; i < m; i++) {
			d[a[i]]++;
			d[b[i]]++;
			uf.unite(a[i], b[i]);
		}
		vector<vector<int> > v(n);
		for (int u = 0; u < n; u++) {
			if (rm[u]) continue;
			int p = uf.find(u);
			if (d[u] == uf.size(p) - 1)
				v[p].push_back(u);
		}
		bool updated = false;
		for (int p = 0; p < n; p++) {
			if (rm[p]) continue;
			if (uf.find(p) != p) continue;
			if (v[p].size() == uf.size(p)) continue;
			updated = true;
			for (int j = 0; j < v[p].size(); j++)
				rm[v[p][j]] = true;
		}
		if (!updated) {
			int x = 0, y = 1;
			for (int p = 0; p < n; p++) {
				if (rm[p]) continue;
				if (uf.find(p) != p) continue;
				x++;
				y = (ll)y * uf.size(p) % _MOD;
			}
			cout << x << endl << y << endl;
			return 0;
		}
		vector<int> _a, _b;
		for (int i = 0; i < m; i++)
			if (!rm[a[i]] && !rm[b[i]]) {
				_a.push_back(a[i]);
				_b.push_back(b[i]);
			}
		m = _a.size();
		a = _a;
		b = _b;
	}
}