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;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXN = 100000;
int n, m;
vector<int> adj[MAXN];
vector<int> radj[MAXN];
int indeg[MAXN], outdeg[MAXN];
bool alive[MAXN];
int q[MAXN], qhead, qtail;
int path[MAXN], npath;
bool onpath[MAXN];
int cyc[MAXN], ncyc;
int cycidx[MAXN];
int state[MAXN];
int mxreachidx[MAXN], mnreachidx[MAXN], mxreachedbyidx[MAXN];
vector<pair<int, int> > ranges;
int sum[MAXN + 1];
bool findcyc(int at) {
  if (onpath[at]) {
    int idx = 0;
    while (path[idx] != at) ++idx;
    ncyc = 0;
    while (idx < npath) cyc[ncyc++] = path[idx++];
    return true;
  }
  path[npath++] = at;
  onpath[at] = true;
  for (int i = (0); i < (((int)(adj[at]).size())); ++i) {
    int to = adj[at][i];
    if (!alive[to]) continue;
    if (findcyc(to)) return true;
  }
  --npath;
  onpath[at] = false;
  return false;
}
bool istop(int at) {
  if (state[at] != 0) return state[at] == 2;
  state[at] = 1;
  for (int i = (0); i < (((int)(adj[at]).size())); ++i) {
    int to = adj[at][i];
    if (cycidx[to] != -1) continue;
    if (!istop(to)) return false;
  }
  state[at] = 2;
  return true;
}
int solve() {
  for (int i = (0); i < (n); ++i) indeg[i] = outdeg[i] = 0, alive[i] = true;
  for (int i = (0); i < (n); ++i)
    for (int j = (0); j < (((int)(adj[i]).size())); ++j) {
      int k = adj[i][j];
      ++outdeg[i];
      ++indeg[k];
    }
  qhead = qtail = 0;
  for (int i = (0); i < (n); ++i)
    if (indeg[i] == 0 || outdeg[i] == 0) {
      alive[i] = false;
      q[qhead++] = i;
    }
  while (qtail < qhead) {
    int at = q[qtail++];
    for (int i = (0); i < (((int)(adj[at]).size())); ++i) {
      int to = adj[at][i];
      if (--indeg[to] == 0 && alive[to]) {
        alive[to] = false;
        q[qhead++] = to;
      }
    }
    for (int i = (0); i < (((int)(radj[at]).size())); ++i) {
      int fr = radj[at][i];
      if (--outdeg[fr] == 0 && alive[fr]) {
        alive[fr] = false;
        q[qhead++] = fr;
      }
    }
  }
  int rt = -1;
  for (int i = (0); i < (n); ++i)
    if (alive[i]) {
      rt = i;
      break;
    }
  assert(rt != -1);
  npath = 0;
  for (int i = (0); i < (n); ++i) onpath[i] = false;
  assert(findcyc(rt));
  for (int i = (0); i < (n); ++i) cycidx[i] = -1;
  for (int i = (0); i < (ncyc); ++i) cycidx[cyc[i]] = i;
  for (int i = (0); i < (n); ++i) state[i] = 0;
  for (int i = (0); i < (n); ++i)
    if (alive[i] && cycidx[i] == -1 && state[i] == 0 && !istop(i)) return -1;
  for (int i = (0); i < (n); ++i) mxreachidx[i] = -1;
  for (int j = ncyc - 1; j >= 0; --j) {
    qhead = qtail = 0;
    q[qhead++] = cyc[j];
    while (qtail < qhead) {
      int at = q[qtail++];
      for (int i = (0); i < (((int)(radj[at]).size())); ++i) {
        int fr = radj[at][i];
        if (!alive[fr] || mxreachidx[fr] != -1 ||
            cycidx[fr] != -1 && cycidx[at] != -1 &&
                (cycidx[fr] + 1) % ncyc == cycidx[at])
          continue;
        mxreachidx[fr] = j;
        if (cycidx[fr] == -1) q[qhead++] = fr;
      }
    }
  }
  for (int i = (0); i < (n); ++i) mnreachidx[i] = -1;
  for (int j = (0); j < (ncyc); ++j) {
    qhead = qtail = 0;
    q[qhead++] = cyc[j];
    while (qtail < qhead) {
      int at = q[qtail++];
      for (int i = (0); i < (((int)(radj[at]).size())); ++i) {
        int fr = radj[at][i];
        if (!alive[fr] || mnreachidx[fr] != -1 ||
            cycidx[fr] != -1 && cycidx[at] != -1 &&
                (cycidx[fr] + 1) % ncyc == cycidx[at])
          continue;
        mnreachidx[fr] = j;
        if (cycidx[fr] == -1) q[qhead++] = fr;
      }
    }
  }
  for (int i = (0); i < (n); ++i) mxreachedbyidx[i] = -1;
  for (int j = ncyc - 1; j >= 0; --j) {
    qhead = qtail = 0;
    q[qhead++] = cyc[j];
    while (qtail < qhead) {
      int at = q[qtail++];
      for (int i = (0); i < (((int)(adj[at]).size())); ++i) {
        int to = adj[at][i];
        if (!alive[to] || mxreachedbyidx[to] != -1 ||
            cycidx[to] != -1 && cycidx[at] != -1 &&
                (cycidx[at] + 1) % ncyc == cycidx[to])
          continue;
        mxreachedbyidx[to] = j;
        if (cycidx[to] == -1) q[qhead++] = to;
      }
    }
  }
  int l = 0, r = ncyc - 1;
  for (int i = (0); i < (ncyc); ++i) {
    int at = cyc[i];
    if (mxreachedbyidx[at] != -1 && mxreachedbyidx[at] >= i) l = max(l, i);
    if (mnreachidx[at] != -1 && mnreachidx[at] <= i) r = min(r, i);
  }
  if (l > r) return -1;
  ranges.clear();
  for (int i = (0); i < (ncyc); ++i) {
    int at = cyc[i];
    if (mxreachidx[at] != -1 && mxreachidx[at] >= i)
      ranges.push_back(make_pair(at, cyc[mxreachidx[at]]));
  }
  for (int i = (0); i <= (ncyc); ++i) sum[i] = 0;
  for (int i = (0); i < (((int)(ranges).size())); ++i) {
    int l = cycidx[ranges[i].first], r = cycidx[ranges[i].second];
    swap(l, r);
    if (l <= r)
      ++sum[l], --sum[r + 1];
    else
      ++sum[0], --sum[r + 1], ++sum[l], --sum[ncyc];
  }
  for (int i = (0); i < (ncyc); ++i) sum[i + 1] += sum[i];
  for (int i = (0); i < (ncyc); ++i)
    if (l <= i && i <= r && sum[i] == ((int)(ranges).size())) return cyc[i] + 1;
  return -1;
}
void run() {
  scanf("%d%d", &n, &m);
  for (int i = (0); i < (m); ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a, --b;
    adj[a].push_back(b);
    radj[b].push_back(a);
  }
  printf("%d\n", solve());
}
int main() {
  run();
  return 0;
}