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;
int sign[200010], td = 0, tin[200010];
struct tarejan {
  int low[200010], disc[200010], n, m;
  vector<int> adj[200010];
  unordered_set<int> StrongSet;
  stack<int> st;
  bool stackm[200010];
  int tim, num;
  void dfs(int node) {
    low[node] = disc[node] = ++tim;
    st.push(node);
    stackm[node] = true;
    for (auto ch : adj[node]) {
      if (disc[ch] == -1) {
        dfs(ch);
        low[node] = min(low[ch], low[node]);
      } else if (stackm[ch] == true) {
        low[node] = min(disc[ch], low[node]);
      }
    }
    if (low[node] == disc[node]) {
      while (st.top() != node) {
        StrongSet.insert(st.top());
        stackm[st.top()] = false;
        st.pop();
      }
      StrongSet.insert(st.top());
      if (StrongSet.size() > 1) {
        td++;
        for (auto v : StrongSet) {
          sign[v] = 1;
          tin[v + 1] = 1;
        }
      }
      StrongSet.clear();
      stackm[st.top()] = false;
      st.pop();
      num++;
    }
  }
  void SCC() {
    tim = 0;
    num = 0;
    for (int i = 0; i <= n; i++) {
      disc[i] = -1;
      low[i] = -1;
      stackm[i] = false;
    }
    for (int i = 0; i < n; i++) {
      if (disc[i] == -1) {
        dfs(i);
      }
    }
  }
} tarj;
vector<int> adg[200010], pdg[200010], dpadj[2][200010];
int vis[200010], sis[200010], ris[200010];
vector<int> path, all;
bool fk = false;
int rim = 1;
bool check_cycle_DAG(int node) {
  if (sis[node] == false) {
    sis[node] = 1;
    ris[node] = 1;
    for (auto v : pdg[node]) {
      if (!sis[v] && check_cycle_DAG(v)) {
        return true;
      } else if (ris[v]) {
        return true;
      }
    }
  }
  ris[node] = false;
  return false;
}
void dfs(int node) {
  if (all.size()) {
    return;
  }
  for (auto v : adg[node]) {
    if (all.size()) {
      return;
    }
    if (!vis[v]) {
      vis[v] = 1;
      path.push_back(v);
      dfs(v);
      if (path.size()) {
        path.pop_back();
      }
    } else {
      while (path.size() && path.back() != v) {
        all.push_back(path.back());
        path.pop_back();
      }
      all.push_back(v);
      reverse(all.begin(), all.end());
      path.clear();
    }
  }
}
int nn;
struct point {
  int mn, mx;
  point() : mn(1000000007), mx(-1000000007) {}
  point(int x) : mn(x), mx(x) {}
  point(int mn, int mx) : mn(mn), mx(mx) {}
  void add(point b) {
    mn = min(mn, b.mn);
    mx = max(mx, b.mx);
  }
};
point twoway[2][200010];
void dp(int tp, int node) {
  if (sis[node]) {
    return;
  }
  sis[node] = true;
  for (auto v : dpadj[tp][node]) {
    if (!vis[v]) {
      dp(tp, v);
      twoway[tp][node].add(twoway[tp][v]);
    } else {
      twoway[tp][node].add(vis[v]);
    }
  }
}
int presum[200010];
void update(int l, int r) {
  if (l <= r) {
    presum[l]++;
    presum[r + 1]--;
  }
}
int main() {
  cin >> tarj.n >> tarj.m;
  for (int i = 1; i <= tarj.m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    b--;
    tarj.adj[a].push_back(b);
  }
  td = 0;
  tarj.SCC();
  if (td == 0) {
    cout << -1 << endl;
  } else if (td > 1) {
    cout << -1 << endl;
  } else {
    int wc = 0;
    for (int i = 0; i < tarj.n; i++) {
      if (sign[i]) {
        wc = i + 1;
        for (auto v : tarj.adj[i]) {
          if (sign[v]) {
            adg[i + 1].push_back(v + 1);
            dpadj[0][i + 1].push_back(v + 1);
            dpadj[1][v + 1].push_back(i + 1);
          }
        }
        tarj.adj[i].clear();
      }
    }
    if (wc != 0) {
      vis[wc] = 1;
      dfs(wc);
    }
    path.clear();
    memset(vis, 0, sizeof vis);
    for (int z = 0; z < all.size(); z++) {
      auto v = all[z];
      tin[v] = 0;
      vis[v] = z + 1;
    }
    nn = all.size();
    vector<int> pol;
    pol.resize(all.size(), 0);
    for (int i = 1; i <= tarj.n; i++) {
      if (tin[i]) {
        for (auto v : adg[i]) {
          if (tin[v]) {
            pdg[i].push_back(v);
          }
        }
      }
    }
    for (int i = 1; i <= tarj.n; i++) {
      if (tin[i] && !sis[i]) {
        if (check_cycle_DAG(i)) {
          fk = true;
          break;
        }
      }
    }
    if (fk) {
      cout << -1 << endl;
      return 0;
    }
    memset(sis, 0, sizeof sis);
    for (int i = 1; i <= tarj.n; i++) {
      if (!sis[i]) {
        dp(0, i);
      }
    }
    memset(sis, 0, sizeof sis);
    for (int i = 1; i <= tarj.n; i++) {
      if (!sis[i]) {
        dp(1, i);
      }
    }
    for (int i = 1; i <= nn; ++i) {
      int v = all[i - 1];
      if (twoway[0][v].mx >= i) update(i + 1, twoway[0][v].mx - 1);
      if (twoway[0][v].mn <= i) update(i + 1, nn);
      if (twoway[1][v].mx >= i) update(1, i - 1);
    }
    for (int i = 1; i <= nn; i++) {
      presum[i] = presum[i] + presum[i - 1];
    }
    int rss = -1;
    for (int i = 1; i <= nn; i++) {
      if (!presum[i]) {
        rss = all[i - 1];
        break;
      }
    }
    cout << rss << endl;
  }
  return 0;
}