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;
pair<int, int> edgeall[555555];
const int MAXN = 1e6 + 10;
int n, m, cycleLength, indexOnCycle[MAXN];
vector<int> out[MAXN];
int visited[MAXN];
vector<int> cycle;
void cutCycle(int v) {
  reverse(cycle.begin(), cycle.end());
  while (cycle.back() != v) {
    cycle.pop_back();
  }
  reverse(cycle.begin(), cycle.end());
  cycleLength = int(cycle.size());
}
bool dfsFindAnyCycle(int u) {
  cycle.push_back(u);
  visited[u] = 1;
  for (int i = 0; i < int(out[u].size()); i++) {
    int v = out[u][i];
    if (!visited[v]) {
      if (dfsFindAnyCycle(v)) {
        visited[u] = 2;
        return true;
      }
    } else {
      if (visited[v] == 1) {
        cutCycle(v);
        visited[u] = 2;
        return true;
      }
    }
  }
  visited[u] = 2;
  cycle.pop_back();
  return false;
}
vector<pair<int, int> > jumps;
int where[MAXN], alias[MAXN], posalias[MAXN];
int dfsJumpThruCycle(int u) {
  if (0) printf("dfsJumpThruCycle(%d)\n", u);
  if (indexOnCycle[u] == 0) {
    visited[u] = true;
  }
  int ret = -1;
  for (int i = 0; i < int(out[u].size()); i++) {
    int v = out[u][i];
    if (0) printf("u = %d v = %d\n", u, v);
    if (!visited[v]) {
      if (indexOnCycle[v] != 0) {
        ret = max(ret, alias[v]);
      } else {
        ret = max(ret, dfsJumpThruCycle(v));
      }
    } else {
      if (where[v] != -1) {
        ret = max(ret, where[v] > cycleLength ? where[v] : posalias[where[v]]);
      }
      if (0) printf("**u = %d v = %d\n", u, v);
      if (0) printf("**where[%d] = %d\n", v, where[v]);
      if (where[v] != -1)
        if (0) printf("**posalias[where[%d]] = %d\n", v, posalias[where[v]]);
    }
  }
  if (0) printf("where[%d] = %d\n", u, ret);
  where[u] = ret;
  return ret;
}
vector<int> mergeJumps() {
  vector<pair<int, int> > merged;
  int b = 0, e = 0;
  for (int i = 0; i < int(jumps.size()); i++) {
    int nb = jumps[i].first, ne = jumps[i].second;
    if (nb <= e) {
      e = max(e, ne);
    } else {
      merged.push_back(make_pair(b, e));
      b = nb;
      e = ne;
    }
  }
  merged.push_back(make_pair(b, e));
  for (int i = 0; i < int(merged.size()); i++) {
    for (int p = merged[i].first; p <= merged[i].second; p++) {
      indexOnCycle[cycle[(p - 1) % cycleLength + 1]] = 0;
    }
  }
  int kochamjulie = 0;
  vector<int> julcia;
  for (int i = 1; i <= n; i++) {
    if (indexOnCycle[i] != 0) {
      julcia.push_back(i);
    }
  }
  return julcia;
}
int lastResult = MAXN;
bool cmp_index(int a, int b) { return indexOnCycle[a] < indexOnCycle[b]; }
int tryCycle() {
  fill(visited + 1, visited + n + 1, false);
  fill(alias + 1, alias + n + 1, false);
  fill(posalias + 1, posalias + n + 1, false);
  fill(indexOnCycle + 1, indexOnCycle + n + 1, false);
  jumps.clear();
  cycleLength = int(cycle.size());
  for (int i = 1; i <= n; i++) where[i] = i;
  if (0) printf("Cycle found (%d):\n", cycleLength);
  cycle.insert(cycle.begin(), 0);
  for (int i = 1; i < int(cycle.size()); i++) {
    if (0) printf("%d\n", cycle[i]);
    indexOnCycle[cycle[i]] = i;
    alias[cycle[i]] = i;
    posalias[i] = i;
  }
  for (int i = 1; i <= cycleLength; i++) {
    alias[cycle[i]] += cycleLength;
    posalias[i] += cycleLength;
    int w = dfsJumpThruCycle(cycle[i]);
    if (0) printf("%d: %d\n", i, w);
    if (w != -1 && w > i + 1) {
      jumps.push_back(make_pair(i + 1, w - 1));
    }
  }
  cycle = mergeJumps();
  sort(cycle.begin(), cycle.end(), cmp_index);
  return int(cycle.size());
}
bool dfsCheckCycleExistence(int u) {
  visited[u] = 1;
  for (int i = 0; i < int(out[u].size()); i++) {
    int v = out[u][i];
    if (!visited[v]) {
      if (dfsCheckCycleExistence(v)) {
        visited[u] = 2;
        return true;
      }
    } else if (visited[v] == 1) {
      visited[u] = 2;
      return true;
    }
  }
  visited[u] = 2;
  return false;
}
bool checkSingleNode(int u) {
  if (0) printf("Checking node %d\n", u);
  fill(visited + 1, visited + n + 1, 0);
  visited[u] = 2;
  for (int i = 1; i <= n; i++) {
    if (!visited[i]) {
      if (dfsCheckCycleExistence(i)) {
        return true;
      }
    }
  }
  return false;
}
void solve() {
  for (int i = 1; i <= n; i++) {
    if (indexOnCycle[i] != 0 && checkSingleNode(i)) indexOnCycle[i] = 0;
  }
  vector<int> julcia;
  for (int i = 1; i <= n; i++) {
    if (indexOnCycle[i] != 0) {
      julcia.push_back(i);
    }
  }
  int kochamjulie = int(julcia.size());
  if (kochamjulie == 0)
    puts("-1");
  else
    printf("%d\n", julcia[0]);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    edgeall[i] = pair<int, int>(u, v);
  }
  sort(edgeall + 1, edgeall + m + 1);
  for (int i = 1; i <= m; i++)
    if (edgeall[i] != edgeall[i - 1]) {
      int u = edgeall[i].first;
      int v = edgeall[i].second;
      out[u].push_back(v);
    }
  for (int i = 1; i <= n; i++) {
    if (!visited[i] && cycleLength == 0) {
      cycle.clear();
      dfsFindAnyCycle(i);
    }
  }
  if (cycleLength == 0) {
    printf("-1\n");
    return 0;
  }
  if (0) printf("Cycle found (%d):\n", cycleLength);
  for (int i = 0; i < int(cycle.size()); i++) {
    if (0) printf("%d\n", cycle[i]);
    indexOnCycle[cycle[i]] = i + 1;
    alias[cycle[i]] = i + 1;
  }
  lastResult = tryCycle();
  solve();
  return 0;
}