#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7, inf = 1061109567;
const long long infll = 4557430888798830399;
const int N = 1e5 + 5;
int n, m;
vector<int> g[N];
struct DSU {
  int p[N], sz[N];
  void init(int n) {
    for (int i = 0; i < n; i++) p[i] = i, sz[i] = 1;
  }
  int getp(int u) { return u == p[u] ? u : p[u] = getp(p[u]); }
  void joint(int u, int v) {
    u = getp(u), v = getp(v);
    if (u == v) return;
    if (sz[u] < sz[v]) swap(u, v);
    sz[u] += sz[v];
    p[v] = u;
  }
} dsu;
bool have[N];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    g[u].push_back(v), g[v].push_back(u);
  }
  int half = (n + 1) / 2 - 1;
  int moreHalf = -1;
  dsu.init(n);
  for (int i = 0; i < n; i++) {
    if (g[i].size() < half) {
      if (moreHalf == -1) moreHalf = i;
      dsu.joint(i, moreHalf);
    } else {
      for (auto j : g[i]) have[j] = 1;
      for (int j = 0; j < n; j++)
        if (!have[j]) dsu.joint(i, j);
      for (auto j : g[i]) have[j] = 0;
    }
  }
  int cnt = 0;
  for (int i = 0; i < n; i++)
    if (dsu.getp(i) == i) cnt++;
  cout << cnt - 1;
  return 0;
}
