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;
const int N = 100100;
namespace scc {
int n;
set<int> ed[N], ed2[N], ind[N];
int old_id[N];
list<int> circle;
bool dfs_circle(int u) {
  static bool visit[N], in_stack[N];
  static int stack[N], stack_size;
  if (visit[u]) return false;
  in_stack[u] = visit[u] = true;
  stack[++stack_size] = u;
  for (int v : ed[u]) {
    if (in_stack[v]) {
      while (true) {
        circle.push_front(stack[stack_size]);
        if (stack[stack_size--] == v) break;
      }
      return true;
    } else if (!visit[v] && dfs_circle(v)) {
      return true;
    }
  }
  in_stack[u] = false;
  return false;
}
namespace checker {
set<int> invalids;
bool vis[N], ins[N];
bool dfs(int u) {
  ins[u] = vis[u] = true;
  for (int v : ed[u]) {
    if (invalids.count(v)) continue;
    if (ins[v] || (!vis[v] && dfs(v))) return true;
  }
  return ins[u] = false;
}
bool has_circle(set<int> st) {
  invalids = move(st);
  fill(vis, vis + n, false);
  for (int i = 0; i < n; ++i) {
    if (invalids.count(i)) continue;
    if (!vis[i] && dfs(i)) {
      return true;
    }
  }
  return false;
}
}  // namespace checker
int ci[N];
void modify_circle() {
  int index = 0;
  for (int x : circle) ci[x] = ++index;
  for (auto it = circle.begin(); it != circle.end(); ++it) {
    int u = *it;
    int i = ci[u];
    int nxt = next(it) == circle.end() ? circle.front() : *next(it);
    for (int v : ed[u]) {
      if (!ci[v]) continue;
      if (v == nxt) continue;
      int j = ci[v];
      if (i < j) {
        for (auto jt = next(it); *jt != v; jt = circle.erase(jt)) {
          ci[*jt] = 0;
        }
      } else {
        while (circle.front() != v) {
          ci[circle.front()] = 0;
          circle.pop_front();
        }
        while (circle.back() != u) {
          ci[circle.back()] = 0;
          circle.pop_back();
        }
      }
    }
  }
  index = 0;
  for (int x : circle) ci[x] = ++index;
}
int dp[N], opt[N], cur;
inline void check_ans(int& ans, int v) {
  if (v != -1 && (ans == -1 || ci[v] > ci[ans])) {
    ans = v;
  }
}
int dfs_dp(int u) {
  if (dp[u] != -2) return dp[u];
  int ans = -1;
  for (int v : ed[u]) {
    check_ans(ans, ci[v] ? v : dfs_dp(v));
  }
  return dp[u] = ans;
}
void init_dp() {
  fill(dp, dp + n, -2);
  for (int u = 0; u < n; ++u) {
    if (!ci[u]) {
      dfs_dp(u);
    } else {
      int ans = -1;
      for (int v : ed[u]) {
        if (ci[v]) continue;
        check_ans(ans, dfs_dp(v));
      }
      opt[u] = ans;
      dp[u] = u;
    }
  }
  copy(ed, ed + n, ed2);
}
int dfs(int u) {
  if (ci[dp[u]] <= cur) return dp[u];
  int ans = -1;
  for (auto it = ed2[u].begin(); it != ed2[u].end();) {
    int v = *it;
    int o = ci[v] ? (ci[v] <= cur ? v : -1) : dfs(v);
    if (o != -1) {
      check_ans(ans, o);
      ++it;
    } else {
      it = ed2[u].erase(it);
    }
  }
  return dp[u] = ans;
}
int find_opt(int u) {
  cur = ci[u];
  int ans = -1;
  for (int v : ed2[u]) {
    if (ci[v]) continue;
    check_ans(ans, dfs(v));
  }
  return ans;
}
void print_circle(const list<int>& lst, const string& message) {
  printf("%s ", message.c_str());
  for (int x : lst) printf("%d ", old_id[x] + 1);
  printf("\n");
}
void remove_range(set<int>& st, int l, int r) {
  for (auto it = st.lower_bound(l); it != st.end() && *it <= r;) {
    it = st.erase(it);
  }
}
void union_range(set<int>& st, int l, int r) {
  for (auto it = st.begin(); it != st.end() && *it < l;) {
    it = st.erase(it);
  }
  while (!st.empty()) {
    auto it = prev(st.end());
    if (*it <= r) break;
    st.erase(it);
  }
}
int solve() {
  dfs_circle(0);
  modify_circle();
  if (checker::has_circle({circle.begin(), circle.end()})) return -1;
  init_dp();
  set<int> st, st2;
  for (int i = 1; i <= (int)circle.size(); ++i) st.insert(i);
  for (auto it = prev(circle.end());; --it) {
    int u = *it;
    int v = find_opt(u);
    if (v == -1) v = opt[u];
    if (v == -1) goto CON;
    if (ci[v] <= ci[u]) {
      union_range(st, ci[v], ci[u]);
    } else if (ci[v] > ci[u]) {
      remove_range(st, ci[u] + 1, ci[v] - 1);
    }
    if (st.empty()) break;
  CON:
    if (it == circle.begin()) break;
  }
  if (st.empty()) return -1;
  int idx = 0;
  for (int x : circle)
    if (st.count(++idx)) st2.insert(x);
  int ans = *st2.begin();
  return checker::has_circle({ans}) ? -1 : old_id[ans] + 1;
}
}  // namespace scc
int n, m;
set<int> ed[N];
int idx, dfn[N], low[N];
int ds[N], dt;
bool ins[N];
int ng[N], dn;
void dfs(int u) {
  dfn[u] = low[u] = ++idx;
  ins[ds[++dt] = u] = true;
  for (int v : ed[u]) {
    if (!dfn[v]) {
      dfs(v);
      low[u] = min(low[u], low[v]);
    } else if (ins[v]) {
      low[u] = min(low[u], dfn[v]);
    }
  }
  if (dfn[u] == low[u]) {
    do {
      ins[ds[dt]] = false, ng[ds[dt]] = dn;
    } while (u != ds[dt--]);
    ++dn;
  }
}
int solve() {
  for (int u = 0; u < n; ++u) {
    if (!dfn[u]) dfs(u);
  }
  int id;
  {
    vector<set<int>> st(dn);
    for (int u = 0; u < n; ++u) st[ng[u]].insert(u);
    vector<int> scc;
    for (int i = 0; i < dn; ++i) {
      if (st[i].size() >= 2) scc.push_back(i);
    }
    if (scc.size() >= 2) return -1;
    if (scc.empty()) {
      vector<int> ans;
      for (int i = 0; i < n; ++i)
        if (ed[i].size() == 0) ans.push_back(i);
      if (ans.size() >= 2) return -1;
      return ans.back() + 1;
    }
    id = scc.back();
  }
  vector<int> nid(n);
  int j = 0;
  for (int u = 0; u < n; ++u) {
    if (ng[u] == id) {
      nid[u] = j;
      scc::old_id[j] = u;
      ++j;
    }
  }
  scc::n = j;
  for (int u = 0; u < n; ++u) {
    if (ng[u] != id) continue;
    int i = nid[u];
    for (int v : ed[u]) {
      if (ng[v] != id) continue;
      int j = nid[v];
      scc::ed[i].insert(j);
    }
  }
  return scc::solve();
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    ed[--u].insert(--v);
  }
  printf("%d\n", solve());
  return 0;
}