#include <bits/stdc++.h>
using namespace std;
vector<long long> v[100000 + 1];
map<pair<long long, long long>, int> mp;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  long long m;
  cin >> m;
  while (m--) {
    long long a, b;
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
    mp[{a, b}] = 1;
    mp[{b, a}] = 1;
  }
  set<long long> s;
  for (int i = 1; i <= n; i++) s.insert(i);
  queue<long long> q;
  s.erase(1);
  long long ans = 0;
  q.push(1);
  while (1) {
    while (!q.empty()) {
      int a = q.front();
      q.pop();
      vector<long long> t;
      for (auto x : s)
        if (mp[{a, x}] == 0) {
          q.push(x);
          t.push_back(x);
        }
      for (auto x : t) s.erase(x);
      if (s.size() == 0) break;
    }
    if (s.size() == 0) break;
    ans++;
    long long to = *s.begin();
    q.push(to);
    s.erase(to);
  }
  cout << ans;
}
