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 inf = 1e9;
int n, m, i, j, h, x, y, v, pos, sum[200005], dp[200005], pre[200005],
    idd[200005], out[200005], in[200005], scc, cntt, ss[200005], buc[200005],
    dfn[200005], low[200005], loww[200005], vis[200005], ring[200005], cnt = 0;
vector<int> e[4][200005], ee[200005];
stack<int> s;
queue<int> q;
void tarjan(int p, int type) {
  int i, v, h;
  dfn[p] = low[p] = ++cnt;
  s.push(p);
  in[p] = 1;
  for (i = 0; i < e[type][p].size(); i++) {
    v = e[type][p][i];
    if (!dfn[v]) {
      tarjan(v, type);
      low[p] = min(low[p], low[v]);
    } else if (in[v])
      low[p] = min(low[p], dfn[v]);
  }
  if (low[p] == dfn[p]) {
    scc++;
    h = s.top();
    while (h != p) {
      ss[h] = scc;
      in[h] = 0;
      buc[scc]++;
      s.pop();
      h = s.top();
    }
    buc[scc]++;
    in[h] = 0;
    ss[h] = scc;
    s.pop();
  }
}
bool find(int p, int id, int sym) {
  int i, v;
  if (in[p]) return false;
  in[p] = 1;
  for (i = 0; i < e[0][p].size(); i++) {
    v = e[0][p][i];
    if (v == sym) {
      cntt = id - 1;
      return true;
    }
    if (find(v, id + 1, sym)) {
      vis[v] = 1;
      ring[id] = v;
      idd[v] = id;
      return true;
    }
  }
  return false;
}
int update(int eq, int a, int b) {
  if (eq == b) return b;
  if (eq == a) return a;
  if (eq - a < 0 && eq - b > 0) return b;
  if (eq - a > 0 && eq - b < 0) return a;
  if (eq - b < eq - a) return b;
  return a;
}
int dfs(int p, int id) {
  int i, v;
  if (loww[p] != inf) return loww[p];
  loww[p] = id + 1 > cntt ? id + 1 - cntt : id + 1;
  for (i = 0; i < e[0][p].size(); i++) {
    v = e[0][p][i];
    if (vis[v])
      loww[p] = update(id, loww[p], idd[v]);
    else
      loww[p] = update(id, loww[p], dfs(v, id));
  }
  return loww[p];
}
bool verify(int p) {
  int i;
  for (i = 1; i <= n; i++) in[i] = dfn[i] = low[i] = ss[i] = 0;
  for (i = 1; i <= scc; i++) buc[i] = 0;
  cnt = scc = 0;
  while (!s.empty()) s.pop();
  for (i = 1; i <= n; i++)
    for (j = 0; j < e[0][i].size(); j++)
      if (i != p && e[0][i][j] != p) e[2][i].push_back(e[0][i][j]);
  for (i = 1; i <= n; i++)
    if (!dfn[i]) tarjan(i, 2);
  for (i = 1; i <= scc; i++)
    if (buc[i] > 1) return false;
  return true;
}
int main() {
  cntt = 0;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    e[3][x].push_back(y);
    ee[y].push_back(x);
    out[x]++;
  }
  for (i = 1; i <= n; i++)
    if (out[i] == 0) q.push(i);
  while (!q.empty()) {
    h = q.front();
    q.pop();
    for (i = 0; i < ee[h].size(); i++) {
      v = ee[h][i];
      out[v]--;
      if (out[v] == 0) q.push(v);
    }
  }
  for (i = 1; i <= n; i++)
    for (j = 0; j < e[3][i].size(); j++)
      if (out[i] && out[e[3][i][j]]) e[0][i].push_back(e[3][i][j]);
  for (i = 1; i <= n; i++)
    if (!dfn[i]) tarjan(i, 0);
  pos = 0;
  for (i = 1; i <= n; i++)
    if (buc[ss[i]] > 1) {
      pos = i;
      break;
    }
  vis[pos] = 1;
  ring[1] = pos;
  find(pos, 2, pos);
  idd[pos] = 1;
  for (i = 1; i <= n; i++)
    for (j = 0; j < e[0][i].size(); j++)
      if (vis[i] == 0 && vis[e[0][i][j]] == 0) e[1][i].push_back(e[0][i][j]);
  for (i = 1; i <= n; i++) in[i] = dfn[i] = low[i] = ss[i] = 0;
  for (i = 1; i <= scc; i++) buc[i] = 0;
  cnt = scc = 0;
  while (!s.empty()) s.pop();
  for (i = 1; i <= n; i++)
    if (!dfn[i]) tarjan(i, 1);
  for (i = 1; i <= scc; i++)
    if (buc[i] > 1) {
      printf("-1");
      return 0;
    }
  for (i = 1; i <= n; i++) loww[i] = inf;
  for (i = 1; i <= cntt; i++) {
    pos = dfs(ring[i], i);
    if (pos > i) {
      pre[pos]++;
      pre[1]++;
      pre[i + 1]--;
    } else
      pre[pos]++, pre[i + 1]--;
  }
  for (i = 1; i <= cntt; i++) {
    sum[i] = sum[i - 1] + pre[i];
    if (sum[i] == cntt) {
      if (verify(ring[i]))
        printf("%d\n", ring[i]);
      else
        printf("-1");
      return 0;
    }
  }
  printf("-1");
  return 0;
}