Problem: Petr is a detective in Braginsk. Somebody stole a huge amount of money from a bank and Petr is to catch him. Somebody told Petr that some luxurious car moves along the roads without stopping.

Petr knows that it is the robbers who drive the car. The roads in Braginsk are one-directional and each of them connects two intersections. Petr wants to select one intersection such that if the robbers continue to drive the roads indefinitely, they will sooner or later come to that intersection. The initial position of the robbers is unknown. Find such an intersection that fits the requirements.

Input

The first line of the input contains two integers n and m (2 ≤ n ≤ 10^5, 2 ≤ m ≤ 5 ⋅ 10^5) — the number of intersections and the number of directed roads in Braginsk, respectively.

Each of the next m lines contains two integers u_i and v_i (1 ≤ u_i, v_i ≤ n, u_i ≠ v_i) — the start and finish of the i-th directed road. It is guaranteed that the robbers can move along the roads indefinitely.

Output

Print a single integer k — the intersection Petr needs to choose. If there are multiple answers, print any. If there are no such intersections, print -1.

Examples

Input

5 6
1 2
2 3
3 1
3 4
4 5
5 3


Output

3

Input

3 3
1 2
2 3
3 1


Output

1

Note

In the first example the robbers can move, for example, along the following routes: (1-2-3-1), (3-4-5-3), (1-2-3-4-5-3-1). We can show that if Petr chooses the 3-rd intersection, he will eventually meet the robbers independently of their route.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
void ckmin(T &a, U b) {
  if (a > b) a = b;
}
template <class T, class U>
void ckmax(T &a, U b) {
  if (a < b) a = b;
}
mt19937 rng(69);
template <class T>
T randomize(T mod) {
  return uniform_int_distribution<T>(0, mod - 1)(rng);
}
int N, M, T, C;
vector<int> edge[100013], rev[100013];
int pos[100013];
int dp[100013], pref[100013];
int st[100013], ft[100013];
vector<int> nodes, cyc;
vector<int> scc[100013];
bitset<100013> seen;
int high;
vector<int> ans;
int vert;
bool better(int a, int b) {
  if (b == -1) return true;
  int da = high - a, db = high - b;
  if (da < 0) da += M;
  if (db < 0) db += M;
  return (da < db);
}
int dfs(int u) {
  if (seen[u]) {
    return (dp[u] == -1 ? -1 : pos[cyc[(dp[u] >= M ? dp[u] - M : dp[u])]]);
  }
  seen[u] = true;
  int res = -1;
  for (int v : edge[u]) {
    if (pos[v] != -1) {
      ckmax(res, pos[v]);
    } else {
      ckmax(res, dfs(v));
    }
  }
  dp[u] = res;
  return res;
}
void dfs_scc(int u) {
  st[u] = T;
  ft[u] = T;
  T++;
  nodes.push_back(u);
  seen[u] = true;
  for (int v : edge[u]) {
    if (!seen[v]) dfs_scc(v);
    ckmin(ft[u], ft[v]);
  }
  if (ft[u] == st[u]) {
    while (!nodes.empty()) {
      int v = nodes.back();
      nodes.pop_back();
      scc[C].push_back(v);
      ft[v] = 1000000007;
      if (v == u) break;
    }
    C++;
  }
}
void getscc() {
  T = 0;
  nodes.clear();
  seen.reset();
  for (auto i = (0); i < (C); i++) {
    scc[i].clear();
  }
  C = 0;
  for (auto i = (0); i < (N); i++) {
    if (!seen[i]) dfs_scc(i);
  }
}
void getcyc() {
  seen.reset();
  for (auto i = (0); i < (C); i++) {
    if (((int)(scc[i]).size()) < 2) continue;
    for (int u : scc[i]) seen[u] = true;
    for (int u : scc[i]) {
      for (auto j = (1); j < (((int)(edge[u]).size())); j++) {
        if (seen[edge[u][j]]) {
          swap(edge[u][j], edge[u][0]);
        }
      }
    }
    for (int u : scc[i]) seen[u] = false;
    cyc.push_back(scc[i][0]);
    while (!seen[cyc.back()]) {
      seen[cyc.back()] = true;
      cyc.push_back(edge[cyc.back()][0]);
    }
    reverse((cyc).begin(), (cyc).end());
    while (cyc.back() != cyc[0]) {
      cyc.pop_back();
    }
    reverse((cyc).begin(), (cyc).end());
    cyc.pop_back();
    break;
  }
  return;
}
int32_t main() {
  cout << fixed << setprecision(12);
  cerr << fixed << setprecision(4);
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> M;
  bool b = false;
  for (auto i = (0); i < (M); i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    if (i == 1 && !(u == 582 && v == 338)) {
      b = false;
    }
    edge[u].push_back(v);
    rev[v].push_back(u);
  }
  getscc();
  getcyc();
  if (cyc.empty()) {
    cout << "-1\n";
    return 0;
  }
  M = ((int)(cyc).size());
  for (auto i = (0); i < (M); i++) {
    int u = cyc[i], v = cyc[(i == M - 1 ? 0 : i + 1)];
    edge[u].erase(find((edge[u]).begin(), (edge[u]).end(), v));
    rev[v].erase(find((rev[v]).begin(), (rev[v]).end(), u));
  }
  seen.reset();
  for (auto i = (0); i < (N); i++) {
    dp[i] = -1;
    pos[i] = -1;
  }
  for (auto i = (0); i < (M); i++) {
    int u = cyc[i];
    pos[u] = i;
  }
  for (auto i = (0); i < (M); i++) {
    int u = cyc[i];
    pos[u] += M;
    dfs(u);
  }
  for (auto i = (0); i < (M); i++) {
    int u = cyc[i];
    int mx = dp[u];
    if (mx == -1) continue;
    if (mx >= M) mx -= M;
    if (mx <= i) {
      pref[0]++;
      pref[mx]--;
      pref[i + 1]++;
      pref[M]--;
    } else {
      pref[i + 1]++;
      pref[mx]--;
    }
  }
  for (auto i = (1); i < (M); i++) {
    pref[i] += pref[i - 1];
  }
  for (auto i = (0); i < (M); i++) {
    int u = cyc[i];
    if (pref[i]) continue;
    ans.push_back(u);
  }
  if (ans.empty()) {
    cout << "-1\n";
    return 0;
  }
  vert = ans[randomize(((int)(ans).size()))];
  for (auto i = (0); i < (M); i++) {
    int u = cyc[i], v = cyc[(i == M - 1 ? 0 : i + 1)];
    edge[u].push_back(v);
    rev[v].push_back(u);
  }
  for (int v : rev[vert]) {
    edge[v].erase(find((edge[v]).begin(), (edge[v]).end(), vert));
  }
  for (int v : edge[vert]) {
    rev[v].erase(find((rev[v]).begin(), (rev[v]).end(), vert));
  }
  edge[vert].clear();
  rev[vert].clear();
  getscc();
  if (b) {
    cout << "ans:";
    for (int u : ans) {
      cout << ' ' << u + 1;
    }
    cout << endl;
    cout << "M = " << M << endl;
    for (auto i = (0); i < (M); i++) {
      if (pref[i] == 0) {
        cout << i << ' ';
      }
    }
    cout << endl;
    cout << "vert = " << vert + 1 << endl;
    return 0;
  }
  for (auto i = (0); i < (C); i++) {
    if (((int)(scc[i]).size()) > 1) {
      cout << "-1\n";
      return 0;
    }
  }
  cout << vert + 1 << '\n';
  return 0;
}