#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <random>
#include <chrono>
using namespace std;
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
ll n, m, G;
vector<vector<ll>> g;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> n >> m >> G;
	g.resize(n);
	vector<pair<ll, ll>> e;
	for (ll i = 0; i < m; ++i) {
		ll u, v;
		cin >> u >> v;
		g[--u].push_back(--v);
		e.push_back({ u, v });
	}
	cout << m - n + 1 << "\n-1";
	cout << endl;
	return 0;
}