#include <bits/stdc++.h>
using namespace std;
int const maxn = 1e5 + 10;
int n, m;
vector<int> g[maxn];
set<int> rest;
void dfs(int u) {
  rest.erase(u);
  vector<int> nbh(rest.size());
  auto it = set_difference(rest.begin(), rest.end(), g[u].begin(), g[u].end(),
                           nbh.begin());
  nbh.resize(it - nbh.begin());
  for (auto v : nbh) rest.erase(v);
  for (auto v : nbh) dfs(v);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) {
    rest.insert(i);
    sort(g[i].begin(), g[i].end());
  }
  int ans = -1;
  for (int i = 1; i <= n; i++)
    if (rest.count(i)) {
      ans++;
      dfs(i);
    }
  printf("%d\n", ans);
  return 0;
}
