#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const int mod0 = 1e9 + 7;
const long long mod1 = 998244353;
const long long mod2 = 1e9 + 9;
const long long mod3 = 2147483647;
const long long inf = 2e9;
const long long INF = 1e16;
const int sz = 64 * 1024;
const long double eps = 1e-7;
void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.precision(16);
}
void solve() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> g(n);
  vector<int> d(n);
  vector<pair<int, int>> e(m);
  for (int i = 0; i < m; ++i) {
    int v, u;
    cin >> v >> u;
    v--, u--;
    e[i] = make_pair(v, u);
    g[v].push_back(u), g[u].push_back(v);
    d[v]++, d[u]++;
  }
  int dmin = d[0], idx = 0;
  for (int i = 1; i < n; ++i) {
    if (d[i] < dmin) {
      dmin = d[i];
      idx = i;
    }
  }
  vector<bool> used(n, 1);
  for (int i : g[idx]) {
    used[i] = 0;
  }
  int ans = 0;
  vector<int> idxs;
  for (int i = 0; i < n; ++i) {
    if (used[i]) continue;
    idxs.push_back(i);
  }
  int cnt = idxs.size();
  vector<vector<int>> g1(n);
  for (int i : idxs) {
    vector<bool> to(n, 1);
    for (int j : g[i]) to[j] = 0;
    to[i] = 0;
    for (int j = 0; j < n; ++j) {
      if (to[j]) g1[i].push_back(j);
    }
  }
  for (int i : idxs) {
    queue<int> q;
    q.push(i);
    bool flag = false;
    vector<bool> used0(n);
    while (!q.empty()) {
      int v = q.front();
      used0[v] = 1;
      q.pop();
      for (int u : g1[v]) {
        if (used0[u]) continue;
        if (used[u]) {
          used[i] = 1;
          flag = true;
          break;
        }
        used0[u] = 1;
        q.push(u);
      }
      if (flag) break;
    }
    if (!flag) ans++;
    used[i] = 1;
  }
  cout << ans << '\n';
}
bool multitest = false;
int main() {
  init();
  int t = 1;
  if (multitest) cin >> t;
  for (int i = 0; i < t; ++i) solve();
}
