#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
const int INF = 1e9 + 7;
const ll MOD = 1e9 + 7;
const int MAXN = 1000006;
int n, m, col[MAXN], p[MAXN];
vi gr[MAXN];
set<int> pointed[MAXN];
struct cmp {
  bool operator()(int a, int b) { return p[a] < p[b]; }
};
int main() {
  cin >> n >> m;
  for (int i = 0, x, y; i < m; i++) {
    cin >> x >> y;
    x--;
    y--;
    gr[x].push_back(y);
    gr[y].push_back(x);
  }
  for (int i = 0; i < n; i++) {
    pointed[0].insert(i);
  }
  int nocc = 0;
  int lsize = 0;
  while (!pointed[lsize].empty()) {
    nocc++;
    int u = *pointed[lsize].begin();
    int size = 1;
    for (int v : gr[u]) {
      if (p[v] == lsize) {
        pointed[p[v]++].erase(v);
        pointed[p[v]].insert(v);
      }
    }
    p[u] = -1;
    for (auto it = ++pointed[lsize].begin(); it != pointed[lsize].end(); it++) {
      for (int v : gr[*it]) {
        if (p[v] >= lsize + size) {
          pointed[p[v]++].erase(v);
          pointed[p[v]].insert(v);
        }
      }
      size++;
      p[*it] = -1;
    }
    pointed[lsize].clear();
    for (int i = lsize + 1; i < lsize + size; i++) {
      for (int u : pointed[i]) {
        for (int v : gr[u]) {
          if (p[v] >= lsize + size) {
            pointed[p[v]++].erase(v);
            pointed[p[v]].insert(v);
          }
        }
        size++;
        p[u] = -1;
      }
      pointed[i].clear();
    }
    lsize += size;
  }
  cout << nocc - 1 << endl;
}
