#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  {
    long long n, e, a, b, ans = 0;
    cin >> n >> e;
    set<long long> g[n];
    for (long long i = 0; i < e; i++) {
      cin >> a >> b;
      g[a - 1].insert(b - 1);
      g[b - 1].insert(a - 1);
    }
    vector<long long> mark(n, 0);
    set<long long> st;
    for (long long i = 0; i < n; i++) st.insert(i);
    for (long long i = 0; i < n; i++) {
      if (!mark[i]) {
        ans++;
        queue<long long> q;
        q.push(i);
        mark[i] = 1;
        while (!q.empty()) {
          a = q.front();
          q.pop();
          set<long long> temp = st;
          for (auto it = st.begin(); it != st.end(); it++) {
            if (g[a].find(*it) == g[a].end()) {
              mark[*it] = 1;
              q.push(*it);
              temp.erase(*it);
            }
          }
          st = temp;
        }
      }
    }
    cout << (--ans) << endl;
  }
}
