#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int n, m;
int res = 0, d[300005];
vector<int> ke[300005], st, vt;
void BFS(int u1) {
  queue<int> qu;
  qu.push(u1);
  d[u1] = 1;
  while (qu.size()) {
    int u = qu.front();
    qu.pop();
    for (int i = 0; i < vt.size(); i++) {
      int x = vt[i];
      if (d[x] == 1) continue;
      int ck1 = lower_bound(ke[u].begin(), ke[u].end(), x) - ke[u].begin();
      int ck2 = upper_bound(ke[u].begin(), ke[u].end(), x) - ke[u].begin();
      if (ck1 == ck2) {
        d[x] = 1;
        st.push_back(x);
        qu.push(x);
      }
    }
    for (int x : st) {
      int xx = lower_bound(vt.begin(), vt.end(), x) - vt.begin();
      vt.erase(xx + vt.begin());
    }
    st.clear();
  }
}
int main() {
  ios_base::sync_with_stdio();
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    ke[u].push_back(v);
    ke[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) sort(ke[i].begin(), ke[i].end());
  for (int i = 2; i <= n; i++) vt.push_back(i);
  for (int i = 1; i <= n; i++) {
    if (d[i] == 0) {
      res++;
      BFS(i);
    }
  }
  cout << res - 1;
}
