#include <bits/stdc++.h>
using namespace std;
set<int> G[100002];
vector<int> g[100002];
int p[100002];
int Find(int x) { return p[x] == x ? x : p[x] = Find(p[x]); }
void link(int x, int y) {
  x = Find(x);
  y = Find(y);
  if (x == y) return;
  p[y] = p[x];
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) p[i] = i;
  while (m--) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    G[x].insert(y);
    G[y].insert(x);
  }
  int y = -1;
  for (int i = 0; i < n; i++) {
    int x = G[i].size();
    if (2 * x < n) {
      if (y != -1)
        link(y, i);
      else
        y = i;
    } else {
      for (int j = 0; j < n; j++)
        if (!G[i].count(j)) link(i, j);
    }
  }
  int ans = -1;
  for (int i = 0; i < n; i++)
    if (Find(i) == i) ans++;
  cout << ans << endl;
}
