#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
struct UF {
  vector<int> e;
  UF(int n) : e(n, -1) {}
  bool same_set(int a, int b) { return find(a) == find(b); }
  int size(int x) { return -e[find(x)]; }
  int find(int x) { return e[x] < 0 ? x : e[x] = find(e[x]); }
  void join(int a, int b) {
    a = find(a), b = find(b);
    if (a == b) return;
    if (e[a] > e[b]) swap(a, b);
    e[a] += e[b];
    e[b] = a;
  }
};
long long int p = 1000000007;
long long int power(long long int a, int b) {
  if (!b) return 1;
  long long int ans = power(a, b / 2);
  ans = (ans * ans) % p;
  if (b % 2) ans = (ans * a) % p;
  return ans;
}
struct Tree {
  const int LOW = 0;
  int f(int a, int b) { return a + b; }
  int n;
  vector<int> s;
  Tree() {}
  Tree(int m, int def = 0) { init(m, def); }
  void init(int m, int def) {
    n = 1;
    while (n < m) n *= 2;
    s.assign(n + m, def);
    s.resize(2 * n, LOW);
    for (int i = n; i-- > 1;) s[i] = f(s[i * 2], s[i * 2 + 1]);
  }
  void update(int pos, int val) {
    pos += n;
    s[pos] = val;
    for (pos /= 2; pos >= 1; pos /= 2) s[pos] = f(s[pos * 2], s[pos * 2 + 1]);
  }
  int query(int l, int r) { return que(1, l, r, 0, n); }
  int que(int pos, int l, int r, int lo, int hi) {
    if (r <= lo || hi <= l) return LOW;
    if (l <= lo && hi <= r) return s[pos];
    int m = (lo + hi) / 2;
    return f(que(2 * pos, l, r, lo, m), que(2 * pos + 1, l, r, m, hi));
  }
};
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  int n, m;
  cin >> n >> m;
  vector<vector<int>> ad(n + 1);
  int a, b, c, d, e, f;
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    ad[a].push_back(b);
    ad[b].push_back(a);
  }
  bool visited[n + 1];
  memset(visited, 0, sizeof(visited));
  a = n - 1;
  int ans = 0;
  vector<int> temp;
  vector<pair<int, int>> temp1;
  int r = 1, l = ad[1].size();
  for (int i = 1; i <= n; i++) {
    if (ad[i].size() < l) {
      r = i;
      l = ad[i].size();
    }
  }
  for (int i = 0; i < ad[r].size(); i++) {
    temp.push_back(ad[r][i]);
    ans++;
    visited[ad[r][i]] = true;
    a--;
  }
  for (int i = 0; i < temp.size(); i++) {
    b = temp[i];
    c = 0;
    d = INT_MAX;
    for (int k = 0; k < temp.size(); k++) {
      if (visited[temp[k]] == true) {
        c = 0;
        b = temp[k];
        for (int j = 0; j < ad[b].size(); j++) {
          int d1 = ad[b][j];
          if (visited[d1] == false) c++;
        }
        if (d > c) {
          e = k;
          d = c;
        }
      }
    }
    b = temp[e];
    c = 0;
    for (int j = 0; j < ad[b].size(); j++) {
      d = ad[b][j];
      if (visited[d] == false) c++;
    }
    if (c == a + 1) {
      visited[b] = false;
      a++;
      continue;
    } else {
      if (c < a + 1) {
        ans--;
        visited[b] = false;
        a++;
      }
    }
  }
  cout << ans;
}
