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>
#pragma comment(linker, "/STACK:800000000")
using namespace std;
const long long INF = 2000000000000200;
void Dkst(vector<vector<pair<int, int> > >& g, vector<long long>& dist,
          vector<int>& parent, int n, int start) {
  dist = vector<long long>(n, INF);
  dist[start] = 0;
  set<pair<long long, long long> > q;
  q.insert(make_pair(dist[start], start));
  while (!q.empty()) {
    long long v = q.begin()->second;
    q.erase(q.begin());
    for (size_t j = 0; j < g[v].size(); ++j) {
      long long to = g[v][j].first, len = g[v][j].second;
      if (dist[v] + len < dist[to]) {
        q.erase(make_pair(dist[to], to));
        dist[to] = dist[v] + len;
        parent[to] = v;
        q.insert(make_pair(dist[to], to));
      }
    }
  }
}
struct People {
  int sx;
  int sy;
  int ex;
  int ey;
};
void Bfs(vector<vector<int> >& g, vector<bool>& used, vector<int>& dist,
         vector<int>& parent, int n, int start) {
  queue<int> q;
  q.push(start);
  used[start] = 1;
  q.push(start);
  dist[start] = 0;
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    for (int i = 0; i < g[v].size(); i++) {
      int to = g[v][i];
      if (!used[to]) {
        q.push(to);
        used[to] = 1;
        parent[to] = v;
        dist[to] = dist[v] + 1;
      }
    }
  }
}
void Dfs(vector<vector<int> >& g, vector<vector<int> >& g2, string* a,
         string* obr, vector<bool>& used, vector<int>& parent, int n, int start,
         int obk, bool& da, int k = 0) {
  if (da) {
    return;
  }
  if (k % 2 == 0) {
    for (size_t i = 0; i < g[start].size(); i++) {
      int per = g[start][i];
      if (a[per] == obr[k]) {
        if (!used[per]) {
          used[per] = 1;
          parent[per] = start;
          if (k == obk) {
            return;
          }
          Dfs(g, g2, a, obr, used, parent, n, per, obk, da, k + 1);
          parent[per] = -1;
          used[per] = 0;
        }
      }
    }
  } else {
    for (size_t i = 0; i < g2[start].size(); i++) {
      int per = g2[start][i];
      if (a[per] == obr[k]) {
        if (!used[per]) {
          used[per] = 1;
          parent[per] = start;
          if (k == obk) {
            return;
          }
          Dfs(g, g2, a, obr, used, parent, n, per, obk, da, k + 1);
          parent[per] = -1;
          used[per] = 0;
        }
      }
    }
  }
}
void Dfs(int n, int first, vector<vector<int> >& g, vector<bool>& used,
         vector<int>& parent) {
  used[first] = 1;
  for (int i = 0; i < g[first].size(); i++) {
    int s = g[first][i];
    if (!used[s]) {
      parent[s] = first;
      Dfs(n, s, g, used, parent);
    }
  }
}
void Dfs4(int n, int first, vector<vector<int> >& g, vector<bool>& used,
          vector<int>& parent) {
  used[first] = 1;
  for (int i = 0; i < g[first].size(); i++) {
    int s = g[first][i];
    if (!used[s]) {
      parent[s] = first;
      Dfs4(n, s, g, used, parent);
    }
  }
}
void Dfs2(int n, int first, vector<vector<int> >& g, vector<int>& used,
          vector<int>& parent) {
  used[first] = 1;
  stack<int> v;
  v.push(first);
  while (!v.empty()) {
    int f = v.top();
    if (g[f].size() > used[f]) {
      v.push(g[f][used[f]]);
      used[f]++;
    } else {
      v.pop();
    }
  }
}
void Dfs3(int n, int first, vector<vector<int> >& g, vector<int>& used,
          vector<int>& parent) {
  used[first] = 1;
  stack<int> v;
  v.push(first);
  while (!v.empty()) {
    int f = v.top();
    if (g[f].size() > 0) {
      for (int i = 0; i < g[f].size(); i++) {
        v.push(g[f][i]);
      }
      used[f] = 1;
    } else {
      v.pop();
    }
  }
}
void peres(int& a, int& b, int a1, int b1, int a2, int b2) {
  if (a1 > b2) {
    a = -1;
    b = -1;
    return;
  }
  if (a1 > a2) {
    int a = a1;
    int b = min(b1, b2);
    return;
  }
  if (a2 > b1) {
    a = -1;
    b = -1;
    return;
  }
  if (a2 > a1) {
    int a = a2;
    int b = min(b1, b2);
    return;
  }
}
int ceil(int a, int b) {
  if (a % b == 0) {
    return a / b;
  }
  return a / b + 1;
}
int binSearchMax(vector<int> a, int b) {
  int i = ceil(a.size(), 2);
  int mx = -1;
  int mn = -1;
  int pr = ceil(i, 2);
  if (a.size() < 2) {
    if (a.size() > 0) {
      if (b <= a[0]) {
        return 0;
      } else {
        return -1;
      }
    } else {
      return -1;
    }
  }
  int da = 0;
  while (da < 2) {
    if (pr <= 1) {
      da++;
    }
    if (a[i] == b) {
      mn = i;
      return mn;
    } else if (a[i] > b) {
      mx = i;
      i = max(i - pr, 0);
    } else {
      mn = i;
      int cn = a.size() - 1;
      i = min(i + pr, cn);
    }
    pr = ceil(pr, 2);
  }
  if (mn != -1) {
    if (a[mn] == b) {
      return mn;
    }
  }
  return mx;
}
int binSearchMin(vector<int> a, int b) {
  int i = ceil(a.size(), 2);
  int mx = -1;
  int mn = -1;
  int pr = i;
  if (a.size() < 2) {
    if (a.size() > 0) {
      if (b >= a[0]) {
        return 0;
      } else {
        return -1;
      }
    } else {
      return -1;
    }
  }
  int da = 0;
  while (da < 2) {
    if (pr <= 1) {
      da++;
    }
    if (a[i] == b) {
      return i;
    } else if (a[i] > b) {
      mx = i;
      i = max(i - pr, 0);
    } else {
      mn = i;
      int cn = a.size() - 1;
      i = min(i + pr, cn);
    }
    pr = ceil(pr, 2);
  }
  if (mx > -1) {
    if (a[mx] == b) {
      return mx;
    }
  }
  return mn;
}
void obrez(vector<int>& ans, int a, int b) {
  if (a == b) {
    ans.clear();
    ans.push_back(a);
  } else if (a < b) {
    int gr1 = binSearchMin(ans, a);
    if (gr1 >= 0) {
      if (ans[gr1] == a) {
        gr1--;
      }
    }
    for (int i = 0; i <= gr1; i++) {
      ans.erase(ans.begin());
    }
    int gr2 = binSearchMax(ans, b) - gr1 - 1;
    if (gr2 > 0) {
      if (ans[gr2] == b) {
        gr2++;
      }
      int ansize = ans.size();
      for (int i = gr2; i < ansize; i++) {
        ans.erase(ans.begin() + gr2);
      }
    }
  } else {
    int gr1 = binSearchMax(ans, b);
    int gr2 = binSearchMin(ans, a);
    if (gr1 >= 0) {
      if (ans[gr1] == b) {
        gr1++;
      }
    }
    if (gr2 >= 0) {
      if (ans[gr2] == a) {
        gr2--;
      }
    }
    for (int i = gr1; i <= gr2; i++) {
      ans.erase(ans.begin() + gr1);
    }
  }
}
bool check;
void Dfs32(int n, int anssize, int first, int& gran, set<int>& ans,
           vector<int>& num, vector<vector<int> >& g, vector<int>& used,
           vector<int>& parent) {
  used[first] = 1;
  stack<int> v;
  v.push(first);
  while (!v.empty()) {
    int f = v.top();
    v.pop();
    if (g[f].size() > 0) {
      bool ka = 0;
      for (int i = 0; i < g[f].size(); i++) {
        int shakal1 = -4;
        int shakal2 = -4;
        int shakal = 0;
        if (ans.size() > 0) {
          shakal = 1;
        }
        int s = g[f][i];
        parent[s] = f;
        if (num[s] == -1) {
          if (used[s] == 0) {
            ka = 1;
            used[s] = 1;
            v.push(s);
          } else if (used[s] == 2) {
            used[f] = 2;
            int f1 = gran;
            int s1 = num[first];
            if (f1 != -1) {
              if (f1 <= s1) {
                set<int>::iterator ff1 = ans.lower_bound(f1);
                set<int>::iterator ss1 = ans.upper_bound(s1);
                ans.erase(ans.begin(), ff1);
                ans.erase(ss1, ans.end());
                if (check && ans.size() < 6) {
                }
              } else {
                set<int>::iterator ff1 = ans.lower_bound(f1);
                set<int>::iterator ss1 = ans.upper_bound(s1);
                ans.erase(ss1, ff1);
                if (check && ans.size() < 6) {
                }
              }
              if (check) {
              }
            }
            int jwefwe2qwd = 23;
          } else {
            int ads = 0;
          }
        } else {
          used[f] = 2;
          used[s] = 2;
          if (gran == -1) {
            gran = num[s];
          }
          int f1 = num[s];
          int s1 = num[first];
          int sg1;
          int sg2;
          if (s1 - gran >= 0) {
            sg1 = s1 - gran + 1;
          } else {
            sg1 = s1 - gran + anssize + 1;
          }
          if (s1 - f1 >= 0) {
            sg2 = s1 - f1 + 1;
          } else {
            sg2 = s1 - f1 + anssize + 1;
          }
          if (sg2 < sg1) {
            gran = f1;
          }
          if (check) {
          }
          if (f1 <= s1) {
            auto ff1 = ans.lower_bound(f1);
            auto ss1 = ans.upper_bound(s1);
            ans.erase(ans.begin(), ff1);
            ans.erase(ss1, ans.end());
            if (check && ans.size() < 6) {
            }
          } else {
            auto ff1 = ans.lower_bound(f1);
            auto ss1 = ans.upper_bound(s1);
            ans.erase(ss1, ff1);
            if (check && ans.size() < 6) {
            }
          }
          if (check && s1 != 1) {
          }
          int jwefwe = 23;
        }
      }
      used[f] = max(1, used[f]);
      if (!ka) {
        for (int d = 0; d < g[f].size(); d++) {
          if (used[g[f][d]] == 2) {
            used[f] = 2;
            break;
          }
        }
      }
    }
    {
      for (int d = 0; d < g[f].size(); d++) {
        if (used[g[f][d]] == 2) {
          used[f] = 2;
          break;
        }
      }
      if (!v.empty()) {
      }
    }
  }
}
void Cycle(int n, int first, vector<int>& num, vector<int>& spnum,
           vector<vector<int> >& g, vector<int>& used, vector<int>& parent,
           bool& da) {
  used[first] = 1;
  if (da) {
    return;
  }
  for (int i = 0; i < g[first].size(); i++) {
    if (da) {
      return;
    }
    int s = g[first][i];
    if (used[s] == 0) {
      parent[s] = first;
      if (da) {
        return;
      }
      Cycle(n, s, num, spnum, g, used, parent, da);
      if (da) {
        return;
      }
    } else if (used[s] == 1) {
      if (da) {
        return;
      }
      parent[s] = first;
      spnum.push_back(s);
      num[s] = 1;
      int por = 2;
      int par = first;
      while (num[par] != 1) {
        num[par] = por;
        spnum.push_back(par);
        par = parent[par];
        por++;
      }
      por--;
      while (por != 0) {
        num[par] = por;
        par = parent[par];
        por--;
      }
      da = 1;
      return;
    }
    if (da) {
      return;
    }
  }
  if (da) {
    return;
  }
  used[first] = 2;
}
void CycleSearch(int n, int first, vector<int>& num, vector<int>& spnum,
                 vector<vector<int> >& g, vector<int>& used,
                 vector<int>& parent, bool& da) {
  used[first] = 1;
  if (da) {
    return;
  }
  for (int i = 0; i < g[first].size(); i++) {
    if (da) {
      return;
    }
    int s = g[first][i];
    if (used[s] == 0) {
      parent[s] = first;
      if (da) {
        return;
      }
      CycleSearch(n, s, num, spnum, g, used, parent, da);
      if (da) {
        return;
      }
    } else if (used[s] == 1) {
      if (da) {
        return;
      }
      parent[s] = first;
      spnum.push_back(s);
      num[s] = 1;
      int por = 2;
      int par = first;
      while (num[par] != 1) {
        num[par] = por;
        spnum.push_back(par);
        par = parent[par];
        por++;
      }
      da = 1;
      return;
    }
    if (da) {
      return;
    }
  }
  if (da) {
    return;
  }
  used[first] = 2;
}
int main() {
  int n, m;
  cin >> n;
  cin >> m;
  int count = 0;
  vector<vector<int> > g(n + 1, vector<int>());
  vector<vector<int> > g2(n + 1, vector<int>());
  vector<int> parent(n, -1);
  vector<int> parent1(n, -1);
  vector<int> parent2(n, -1);
  vector<int> parent228(n, -1);
  vector<int> num(n + 1, -1);
  check = 0;
  for (int i = 0; i < m; i++) {
    int f, s;
    cin >> f >> s;
    f--;
    s--;
    g[f].push_back(s);
    g2[f].push_back(s);
    if (i == 0 && n == 1000 && m == 100000) {
      if (f == 681 && s == 484) {
        check = 1;
      }
    }
  }
  stack<int> st;
  for (int i = 0; i < n; i++) {
    if (g[i].size() == 0) {
      st.push(i);
    }
  }
  vector<int> used(n + 1, 0);
  vector<int> used1(n + 1, 0);
  vector<int> used2(n + 1, 0);
  vector<int> spnum;
  set<int> ans;
  bool da1 = 0;
  for (int i = 0; i < n; i++) {
    if (used1[i] == 0) {
      Cycle(n, i, num, spnum, g, used1, parent1, da1);
    }
  }
  reverse(spnum.rbegin(), spnum.rend());
  for (int i = 1; i <= spnum.size(); i++) {
    ans.insert(i);
  }
  int numi = -1;
  int numcount = spnum.size();
  for (int i = 0; i < spnum.size(); i++) {
    numi = num[spnum[i]];
    for (int d = 0; d < g[spnum[i]].size(); d++) {
      if (num[g[spnum[i]][d]] == numi + 1 ||
          (numi == numcount && num[g[spnum[i]][d]] == 1)) {
        g[spnum[i]].erase(g[spnum[i]].begin() + d);
      }
    }
  }
  if (check) {
    for (auto d : ans) {
    }
  }
  int gran = -1;
  set<int> ans2;
  int ansize = ans.size();
  ans2 = ans;
  for (auto d : ans2) {
    Dfs32(n, ansize, spnum[d - 1], gran, ans, num, g, used, parent);
    if (check) {
    }
  }
  if (ans.size() > 0) {
    int ans1 = *ans.begin();
    int gs = g2[ans1].size();
    g2[spnum[ans1 - 1]].clear();
    bool da2 = 0;
    for (int i = 0; i < n; i++) {
      if (n == 100000) {
      }
      CycleSearch(n, i, num, spnum, g2, used2, parent2, da2);
    }
    if (da2) {
      cout << -1;
    } else {
      cout << spnum[ans1 - 1] + 1;
    }
  } else {
    cout << -1;
  }
}