#include <bits/stdc++.h>
using namespace std;
int dx4[] = {-1, 0, 1, 0};
int dy4[] = {0, 1, 0, -1};
int dx8[] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dy8[] = {0, 1, 1, 1, 0, -1, -1, -1};
void Duxar(int _this_line) {}
bool AreEqual(double a, double b) { return (fabs(a - b) < 1e-10); }
template <class T>
bool GetNr(T &_value) {
  T _sign = 1;
  char ch;
  _value = 0;
  while (!isdigit(ch = getchar())) {
    if (ch == -1) {
      return false;
    }
    ch == '-' ? _sign = -1 : _sign = 1;
  }
  do {
    _value = _value * 10 + (ch - '0');
  } while (isdigit(ch = getchar()));
  _value *= _sign;
  return true;
}
template <class T>
void PutNr(T _value, char _ch = ' ') {
  cout << _value << _ch;
}
struct Segment {
  int st, en, pos;
};
bool Compare1(Segment a, Segment b) {
  if (a.st != b.st) {
    return a.st < b.st;
  }
  return a.en > b.en;
}
int N, M;
vector<Segment> segments, saved;
vector<int> removed;
int main() {
  string fileInput = "sum";
  int i, j, last_right = 0;
  GetNr(N);
  GetNr(M);
  segments.resize(M);
  for (i = 0; i < M; ++i) {
    GetNr(segments[i].st);
    GetNr(segments[i].en);
    segments[i].en += segments[i].st - 1;
    segments[i].pos = i + 1;
  }
  sort((segments).begin(), (segments).end(), Compare1);
  for (auto sg : segments) {
    if (sg.en <= last_right) {
      removed.push_back(sg.pos);
    } else {
      last_right = sg.en;
      saved.push_back(sg);
    }
  }
  M = saved.size();
  for (i = 0; i < M; i = j) {
    for (j = i + 1; j + 1 < M; ++j) {
      if (saved[j + 1].st <= saved[i].en + 1) {
        removed.push_back(saved[j].pos);
      } else {
        break;
      }
    }
  }
  PutNr(removed.size(), '\n');
  for (auto x : removed) {
    PutNr(x);
  }
  putchar('\n');
  return 0;
}
