#include <bits/stdc++.h>
using namespace std;
int main() {
  if (false) {
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  }
  int n, m;
  cin >> n >> m;
  vector<pair<pair<int, int>, int> > a(m);
  vector<bool> used(m, false);
  for (int i = 0; i < m; ++i) {
    int begin, len;
    cin >> begin >> len;
    a[i] = make_pair(make_pair(begin, begin + len - 1), i);
  }
  sort(a.begin(), a.end());
  int ind0 = 0, ind2 = -1;
  int count = 1;
  used[a[0].second] = true;
  int ii = a[ind0].first.first;
  int jj = a[ind0].first.second;
  for (int i = 1; i < m; ++i) {
    if (a[i].first.first == ii) {
      if (a[i].first.second < jj) {
      } else if (a[i].first.second >= jj && ind2 < 0) {
        used[a[ind0].second] = false;
        ind0 = i;
        used[a[i].second] = true;
        jj = a[i].first.second;
      } else if (a[i].first.second >= jj && ind2 >= 0) {
        count--;
        used[a[ind0].second] = false;
        used[a[ind2].second] = false;
        used[a[i].second] = true;
        ind0 = i;
        ind2 = -1;
        ii = a[i].first.first;
        jj = a[i].first.second;
      } else {
        cout << "error 1" << endl;
        return 1;
      }
    } else if (a[i].first.first <= jj && a[i].first.second <= jj) {
    } else if (a[i].first.first > jj + 1) {
      used[a[i].second] = true;
      count++;
      ind0 = i;
      ind2 = -1;
      ii = a[i].first.first;
      jj = a[i].first.second;
    } else if (ind2 < 0) {
      count++;
      used[a[i].second] = true;
      ind2 = i;
      jj = a[i].first.second;
    } else if (a[i].first.first <= a[ind0].first.second + 1) {
      used[a[ind2].second] = false;
      used[a[i].second] = true;
      ind2 = i;
      jj = a[i].first.second;
    } else if (a[i].first.first > a[ind0].first.second + 1) {
      count++;
      used[a[i].second] = true;
      ii = a[ind2].first.first;
      ind0 = ind2;
      jj = a[i].first.second;
      ind2 = i;
    } else {
      cout << "error 2" << endl;
      return 2;
    }
  }
  cout << (m - count) << endl;
  bool flag = false;
  for (int i = 0; i < m; i++) {
    if (!used[i]) {
      if (flag) {
        cout << " ";
      } else {
        flag = true;
      }
      cout << (i + 1);
    }
  }
  cout << endl;
  if (false) {
    fclose(stdin);
    fclose(stdout);
  }
  return 0;
}
