#include <bits/stdc++.h>
using namespace std;
set<long long> cmp;
long long sz[100005];
long long par[100005];
vector<long long> adj[100005];
long long find_set(long long v) {
  if (v == par[v]) return v;
  return find_set(par[v]);
}
void unite(long long u, long long v) {
  u = find_set(u);
  v = find_set(v);
  if (u == v) return;
  if (sz[u] < sz[v]) swap(u, v);
  par[v] = u;
  sz[u] += sz[v];
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, m;
  cin >> n >> m;
  for (long long i = 0; i < m; i++) {
    long long u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (long long i = 1; i <= n; i++) {
    par[i] = i;
    sz[i] = 1;
    map<long long, long long> mp;
    for (long long it : adj[i]) {
      if (it > i) continue;
      mp[find_set(it)]++;
    }
    set<long long> ncmp;
    for (long long it : cmp) {
      if (sz[it] > mp[it]) {
        unite(it, i);
      } else {
        ncmp.insert(it);
      }
    }
    ncmp.insert(find_set(i));
    cmp = ncmp;
  }
  cout << cmp.size() - 1 << '\n';
  return 0;
}
