#include <bits/stdc++.h>
using namespace std;
const int maxn = 100100;
set<int> st, g[maxn];
int n, m, cnt;
void dfs(int u) {
  st.erase(u);
  set<int>::iterator it;
  int v = 0;
  while ((it = st.upper_bound(v)) != st.end()) {
    v = *it;
    if (g[u].count(v)) continue;
    dfs(v);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  while (m--) {
    int x, y;
    cin >> x >> y;
    g[x].insert(y);
    g[y].insert(x);
  }
  for (int i = 1; i <= n; i++) st.insert(i);
  for (int i = 1; i <= n; i++)
    if (st.count(i)) cnt++, dfs(i);
  printf("%d\n", cnt - 1);
  return 0;
}
