#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2e6 + 5;
long long a[maxn], ii[maxn], o[maxn], r[maxn];
long long n, m, q, rr, p;
signed main() {
  cin >> n >> m;
  for (long long i = 1; i <= m; i++) {
    cin >> p >> q;
    a[p]++;
    a[p + q]--;
    if (p + q - 1 > r[p]) {
      r[p] = p + q - 1;
      ii[p] = i;
    }
  }
  for (long long i = 1; i <= n; i++) {
    a[i] += a[i - 1];
  }
  q = 0;
  for (long long i = 1; i <= n; i++) {
    if (r[i] > q) {
      q = r[i];
      p = ii[i];
    }
    if (a[i] && rr < i) {
      rr = q;
      o[p] = 1;
    }
  }
  p = 0;
  for (long long i = 1; i <= m; i++) {
    if (!o[i]) {
      a[++p] = i;
    }
  }
  cout << p << endl;
  for (long long i = 1; i <= p; i++) {
    cout << a[i] << " ";
  }
  return 0;
}
