#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
const int mod = 1e9 + 7;
int f[maxn];
vector<int> e[maxn];
int b[maxn], c[maxn];
vector<int> v, t;
int find(int x) {
  if (f[x] == x) return x;
  return f[x] = find(f[x]);
}
void uni(int x, int y) {
  int xx = find(x);
  int yy = find(y);
  if (xx != yy) f[xx] = yy;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = (0); i < (m); i++) {
    int x, y;
    cin >> x >> y;
    e[x].push_back(y);
    e[y].push_back(x);
  }
  for (int i = (1); i < (n + 1); i++) sort(e[i].begin(), e[i].end());
  int mx = 1;
  for (int i = (2); i < (n + 1); i++)
    if ((int)e[i].size() < (int)e[mx].size()) mx = i;
  for (int i = (1); i < (n + 1); i++) f[i] = i;
  for (auto u : e[mx]) b[u] = 1;
  for (int i = (1); i < (n + 1); i++)
    if (!b[i])
      v.push_back(i), uni(i, mx);
    else
      t.push_back(i);
  for (auto x : v) {
    for (auto u : e[x]) c[u]++;
  }
  for (int i = (1); i < (n + 1); i++)
    if (b[i] && c[i] != (int)v.size()) uni(i, mx);
  for (int i = (0); i < ((int)t.size()); i++)
    for (int j = (0); j < ((int)t.size()); j++)
      if (i != j) {
        int x = t[i], y = t[j];
        if ((*lower_bound(e[x].begin(), e[x].end(), y)) != y) uni(x, y);
      }
  int ans = 0;
  for (int i = (1); i < (n + 1); i++)
    if (find(i) == i) ans++;
  cout << ans - 1;
  return 0;
}
