#include <bits/stdc++.h>
using namespace std;
set<int> nodos;
set<int> Adj[100001];
deque<pair<int, int> > DQ;
int N, M;
bitset<200000> used;
int main() {
  used.reset();
  cin >> N >> M;
  for (int i = 0; i < M; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    Adj[a].insert(b);
    Adj[b].insert(a);
  }
  for (int i = 1; i <= N; i++) nodos.insert(i);
  DQ.push_front({1, 0});
  int ct = 0;
  while (DQ.size()) {
    auto p = DQ.front();
    DQ.pop_front();
    int n = p.first;
    if (!used[n]) {
      used[n] = true;
      ct += p.second;
      set<int> ln = nodos;
      for (auto k : ln) {
        if (Adj[n].count(k) == 0) {
          DQ.push_front({k, 0});
          nodos.erase(k);
        }
      }
      for (auto k : Adj[n]) DQ.push_back({k, 1});
    }
  }
  cout << ct << endl;
}
