#include <bits/stdc++.h>
using namespace std;
long long n, m;
set<long long> v[100005];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> m;
  for (long long i = 0; i < m; i++) {
    long long a, b;
    cin >> a >> b;
    v[a].insert(b);
    v[b].insert(a);
  }
  set<long long> s;
  set<pair<long long, long long>> vis;
  for (long long i = 1; i <= n; i++) vis.insert({1, i});
  set<long long> left;
  for (long long i = 1; i <= n; i++) left.insert(i);
  long long ans = 0;
  while (vis.size()) {
    pair<long long, long long> p = *vis.begin();
    vis.erase(p);
    ans += p.first;
    vector<long long> er;
    for (long long j : left) {
      if (v[p.second].find(j) == v[p.second].end()) {
        er.push_back(j);
        vis.erase({1, j});
        vis.insert({0, j});
      }
    }
    for (long long j : er) left.erase(j);
  }
  cout << ans - 1;
}
