#include <string>
#include <bitset>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>

using namespace std;
using ll = long long;
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()

// #define SUBMIT

#ifdef SUBMIT
    #pragma GCC optimize("Ofast,unroll-loops")
#endif

void fast() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    cout << setprecision(8) << fixed;
}

ll mod = 1e9 + 7;
ll binpow(ll a, ll n) {
    ll res = 1;
    for (int i = 0; (1ll << i) <= n; ++i, a = a * a % mod) {
        if ((n >> i) & 1) res = res * a % mod;
    }
    return res;
}

ll INF = 1e18;
void solve() {
    int n, m, _;
    cin >> n >> m >> _;
    vector<pair<int, int>> es(m);
    vector<int> in(n), out(n);
    for (int i = 0; i < m; ++i) {
        int v, u;
        cin >> v >> u;
        --v, --u;
        in[u]++, out[v]++;
        es[i] = make_pair(v, u);
    }
    cout << m - n  + 1 << '\n';
    cout << -1 << '\n';
} 

int main() {
    fast();
    int t = 1;
    // cin >> t;
    while (t--) solve();
    return 0;
}