#include <bits/stdc++.h>
using namespace std;
const int LIMIT = 1e5 + 7;
int n, m, v, u, r;
set<int> edges;
map<pair<int, int>, bool> g;
bool visited[LIMIT];
void dfs(int p) {
  visited[p] = true;
  edges.erase(p);
  set<int>::iterator it = edges.begin();
  while (it != edges.end()) {
    int t = *it;
    if (!visited[t] && !g[{p, t}]) {
      dfs(t);
    }
    it = edges.upper_bound(t);
  }
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &v, &u);
    g[{u, v}] = true;
    g[{v, u}] = true;
  }
  for (int i = 1; i <= n; i++) {
    edges.insert(i);
  }
  for (int i = 1; i <= n; i++) {
    if (!visited[i]) {
      dfs(i);
      r++;
    }
  }
  printf("%d", r - 1);
  return EXIT_SUCCESS;
}
