#include <bits/stdc++.h>
template <typename Y>
inline bool updmin(Y &a, Y b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename Y>
inline bool updmax(Y &a, Y b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename Y>
inline Y abs(Y a) {
  if (a < 0) a = -a;
  return a;
}
template <typename Y>
inline Y sqr(Y a) {
  return a * a;
}
int read() {
  int w = 1, q = 0, ch = ' ';
  for (; ch < '0' || ch > '9'; ch = getchar())
    if (ch == '-') w = -1;
  for (; ch >= '0' && ch <= '9'; ch = getchar()) q = q * 10 + ch - 48;
  return q * w;
}
inline void FileIO() {
  freopen(
      ""
      ".in",
      "r", stdin);
  freopen(
      ""
      ".out",
      "w", stdout);
}
const int maxn = 100010;
std::vector<int> G[maxn], s, sta;
int n, m, vis[maxn], ths;
std::bitset<maxn> d, tmp;
void dfs(int p) {
  if (p == ths) {
    return;
  }
  vis[p] = 1;
  sta.push_back(p);
  for (int t : G[p]) {
    if (!vis[t]) {
      dfs(t);
    } else if (vis[t] == 1) {
      tmp.reset();
      for (size_t i = sta.size() - 1;; i--) {
        tmp.set(sta[i]);
        if (sta[i] == t) {
          break;
        }
      }
      d &= tmp;
      throw 1;
    }
  }
  vis[p] = 2;
  sta.pop_back();
}
int main() {
  srand(19890604);
  n = read();
  m = read();
  for (int i = 1; i <= m; i++) {
    int x = read(), y = read();
    G[x].push_back(y);
  }
  for (int i = 1; i <= n; i++) {
    std::random_shuffle(G[i].begin(), G[i].end());
    s.push_back(i);
  }
  std::random_shuffle(s.begin(), s.end());
  d.set();
  for (int i : s) {
    if ((double)clock() / CLOCKS_PER_SEC >= 0.15) break;
    if (d.test(i)) {
      ths = i;
      for (int j = 1; j <= n; j++) {
        vis[j] = 0;
      }
      try {
        for (int j : s) {
          if (!vis[j]) {
            sta.clear();
            dfs(j);
          }
        }
      } catch (int) {
        d.reset(i);
        continue;
      }
      printf("%d\n", i);
      return 0;
    }
  }
  puts("-1");
  return 0;
}
