#include <bits/stdc++.h>
using namespace std;
const int nmax = 2000100;
const int mod = 1000000007;
int b[nmax];
int m, n;
int l[nmax], r[nmax], a[nmax];
int use[nmax];
bool f(int x, int y) { return l[x] < l[y]; }
int main() {
  cin >> n >> m;
  for (int i = 1; i <= m; ++i) {
    cin >> l[i] >> r[i];
  }
  for (int i = 1; i <= m; ++i) {
    a[i] = i;
    r[i] += l[i] - 1;
  }
  sort(a + 1, a + m + 1, f);
  int pos = 1;
  int cur = 1;
  int ans = m;
  while (pos <= m) {
    int cur1 = cur - 1;
    int dop = 0;
    while (pos <= m && l[a[pos]] <= cur) {
      if (cur1 < r[a[pos]]) {
        dop = a[pos];
        cur1 = r[a[pos]];
      }
      pos++;
    }
    if (dop) {
      use[dop] = 1;
      ans--;
    }
    cur = max(cur1 + 1, cur + 1);
  }
  cout << ans << endl;
  for (int i = 1; i <= m; ++i)
    if (!use[i]) cout << i << ' ';
  cout << endl;
  return 0;
}
