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 long long int inf = 0x3f3f3f3f;
const int mx = 2e5 + 5;
const int mod = 1e9 + 7;
const int x_move[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int y_move[] = {0, 0, 1, -1, 1, -1, 1, -1};
int n, m;
vector<int> g[mx], a[mx], b[mx];
int cir[mx];
int id[mx];
int low[mx], pre[mx], ssc[mx];
int dp[mx];
int vis[mx];
bool ok;
int num[mx];
stack<int> st;
int dfn, cnt;
int sum, bg;
struct node {
  int a, b;
  node() {
    a = 3e6;
    b = 0;
  }
  friend node operator+(node &o, node &p) {
    node z;
    z.a = min(o.a, p.a);
    z.b = max(o.b, p.b);
    return z;
  }
  friend node operator+(node &o, int p) {
    node z;
    z.a = min(o.a, p);
    z.b = max(o.b, p);
    return z;
  }
} fr[mx], ba[mx];
void tarjan(int u) {
  pre[u] = low[u] = ++dfn;
  st.push(u);
  for (auto v : g[u]) {
    if (!pre[v]) {
      tarjan(v);
      low[u] = min(low[u], low[v]);
    } else if (!ssc[v])
      low[u] = min(low[u], pre[v]);
  }
  if (low[u] == pre[u]) {
    cnt++;
    if (st.top() != u) sum++;
    while (1) {
      int x = st.top();
      st.pop();
      ssc[x] = cnt;
      num[cnt]++;
      if (x == u) break;
    }
  }
}
bool dfs(int u) {
  if (vis[u] && u == bg) return true;
  if (vis[u]) return false;
  vis[u] = 1;
  cir[++cir[0]] = u;
  for (auto v : g[u])
    if (dfs(v)) return true;
  cir[0]--;
  return false;
}
void dfs1(int u) {
  vis[u] = 1;
  for (auto v : a[u]) {
    if (!id[v]) {
      if (!vis[v])
        dfs1(v);
      else if (vis[v] == 1)
        ok = false;
    }
    if (id[v])
      fr[u] = fr[u] + id[v];
    else
      fr[u] = fr[v] + fr[u];
  }
  vis[u] = 2;
}
void dfs2(int u) {
  vis[u] = 1;
  for (auto v : b[u]) {
    if (!id[v]) {
      if (!vis[v])
        dfs2(v);
      else if (vis[v] == 1)
        ok = false;
    }
    if (id[v])
      ba[u] = ba[u] + id[v];
    else
      ba[u] = ba[u] + ba[v];
  }
  vis[u] = 2;
}
void add(int l, int r) {
  if (r < l) return;
  dp[l]++;
  dp[r + 1]--;
}
int solve() {
  for (int i = 1; i <= cir[0]; i++) id[cir[i]] = i;
  for (int u = 1; u <= n; u++) {
    for (auto v : g[u]) {
      if (id[v] == id[u] % cir[0] + 1) continue;
      a[u].push_back(v);
      b[v].push_back(u);
    }
  }
  for (int u = 1; u <= n; u++) g[u] = a[u];
  dfn = cnt = sum = 0;
  memset(pre, 0, sizeof(pre));
  memset(ssc, 0, sizeof(ssc));
  for (int i = 1; i <= n; i++)
    if (!pre[i]) tarjan(i);
  if (sum > 1) return -1;
  memset(vis, 0, sizeof(vis));
  for (int i = 1; i <= n; i++)
    if (!vis[i]) dfs1(i);
  memset(vis, 0, sizeof(vis));
  for (int i = 1; i <= n; i++)
    if (!vis[i]) dfs2(i);
  if (!ok) return -1;
  for (int i = 1; i <= cir[0]; i++) {
    if (fr[cir[i]].b >= i) add(i + 1, fr[cir[i]].b - 1);
    if (fr[cir[i]].a <= i) add(i + 1, cir[0]);
    if (ba[cir[i]].b >= i) add(1, i - 1);
  }
  for (int i = 1; i <= cir[0]; i++) {
    dp[i] += dp[i - 1];
    if (!dp[i]) return cir[i];
  }
  return -1;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    g[u].push_back(v);
  }
  cir[0] = n;
  for (int i = 1; i <= n; i++)
    if (!pre[i]) tarjan(i);
  if (sum > 1) return 0 * puts("-1");
  for (int i = 1; i <= n; i++)
    if (num[ssc[i]] > 1) bg = i;
  cir[0] = 0;
  ok = true;
  dfs(bg);
  printf("%d\n", solve());
  return 0;
}