#include <bits/stdc++.h>
using namespace std;
int so, si;
int stk[2000], top;
bool g[2000][2000];
vector<int> adj[2000];
int par[2000];
bool vis[2000], thr[2000];
int in[2000], out[2000];
bool FindPath() {
  int i, u, v;
  vis[so] = true;
  top = 0;
  stk[top] = so;
  par[so] = -1;
  while (top >= 0) {
    u = stk[top];
    top--;
    if (u == si) {
      break;
    }
    for (i = adj[u].size() - 1; i >= 0; i--) {
      v = adj[u][i];
      if (vis[v] == false && g[u][v] == true) {
        top++;
        stk[top] = v;
        par[v] = u;
        vis[v] = true;
      }
    }
  }
  if (vis[si] == false) {
    return false;
  }
  u = si;
  while (par[u] != -1) {
    g[par[u]][u] = false;
    g[u][par[u]] = true;
    u = par[u];
  }
  return true;
}
int main() {
  int n, m, u, v, i, j, mm = 0;
  cin >> n >> m;
  memset(thr, false, sizeof(thr));
  int ans = 2000000000;
  for (i = 0; i < m; i++) {
    cin >> u >> v;
    if (u == v) {
      thr[u] = true;
    } else {
      in[v]++;
      out[u]++;
    }
    adj[u].push_back(v + n);
    adj[v + n].push_back(u);
    g[u][v + n] = true;
  }
  so = 0;
  si = n + n + 1;
  for (i = 1; i <= n; i++) {
    adj[so].push_back(i);
    adj[i + n].push_back(si);
    g[so][i] = true;
    g[i + n][si] = true;
  }
  memset(vis, false, sizeof(vis));
  while (FindPath()) {
    memset(vis, false, sizeof(vis));
    mm++;
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      if (g[j + n][i] == true) {
        g[i][j + n] = true;
        g[j + n][i] = false;
        g[so][i] = true;
        g[i][so] = false;
        g[j + n][si] = true;
        g[si][j + n] = false;
        mm--;
      }
      if (g[i + n][j] == true) {
        g[j][i + n] = true;
        g[i + n][j] = false;
        g[so][j] = true;
        g[j][so] = false;
        g[i + n][si] = true;
        g[si][i + n] = false;
        mm--;
      }
    }
    memset(vis, false, sizeof(vis));
    vis[i] = true;
    vis[i + n] = true;
    while (FindPath()) {
      mm++;
      memset(vis, false, sizeof(vis));
      vis[i] = true;
      vis[i + n] = true;
    }
    ans = min(ans, (thr[i] == true ? -1 : 1) + n - 1 - mm + 2 * (n - 1) -
                       in[i] - out[i] + (m - in[i] - out[i] - mm));
  }
  cout << ans << endl;
  return 0;
}
