#include <bits/stdc++.h>
using namespace std;
set<int> e[100005];
int n, m;
int ans;
set<int> unMST;
set<int> zeroDis;
set<int> unZeroDis;
void dfs(int u) {
  unMST.erase(u);
  int minLink = -1;
  int notInDir = -1;
  if (unMST.size() == 0) return;
  for (auto it = unZeroDis.begin(); it != unZeroDis.end();) {
    if (unMST.find(*it) == unMST.end()) {
      it = unZeroDis.erase(it);
      continue;
    }
    if (e[u].find(*it) == e[u].end()) {
      zeroDis.insert(*it);
      it = unZeroDis.erase(it);
    } else {
      it++;
    }
  }
  if (zeroDis.size() == 0) {
    for (auto& it : e[u]) {
      if (unMST.find(it) != unMST.end()) {
        minLink = it;
        break;
      }
    }
    if (minLink == -1) {
      return;
    }
    ans++;
    dfs(minLink);
  } else {
    int v = *zeroDis.begin();
    zeroDis.erase(zeroDis.begin());
    dfs(v);
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cin >> n >> m;
  int i;
  for (i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    e[a].insert(b);
    e[b].insert(a);
  }
  for (i = 1; i <= n; i++) {
    unMST.insert(i);
    unZeroDis.insert(i);
  }
  dfs(1);
  cout << ans << endl;
}
