#include <bits/stdc++.h>
using namespace std;
const int N = 2000010;
const int M = 2000010;
const int mod = 10007;
const int inf = 0x3f3f3f3f;
const double eps = 1e-6;
using namespace std;
struct Data {
  int l, r, id;
  Data() {}
  Data(int l, int r, int id) : l(l), r(r), id(id) {}
} da[N];
bool cmp(const Data& A, const Data& B) { return A.l < B.l; }
bool vis[N];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    r += l - 1;
    da[i] = Data(l, r, i);
  }
  int pre = 0;
  int ret = 0, r = 0;
  sort(da, da + m, cmp);
  vector<int> vt;
  for (int i = 0; i < m;) {
    int tr = r, id = -1;
    while (i < m && da[i].l <= r + 1) {
      if (tr < da[i].r) tr = da[i].r, id = da[i].id;
      i++;
    }
    if (id + 1)
      vt.push_back(id), r = tr, vis[id + 1] = 1;
    else
      r++;
  }
  cout << (m - vt.size()) << endl;
  for (int i = 1; i <= m; i++)
    if (!vis[i]) cout << i << " ";
  return 0;
}
