#include <bits/stdc++.h>
using namespace std;
int v[2000001], a[200001], b[200001];
priority_queue<int> q[2000001];
int ans = 0;
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> a[i] >> b[i];
    q[a[i]].push(a[i] + b[i]);
  }
  int f = 0;
  for (int i = 1; i <= n; i++) {
    if (!f) {
      f = 1;
      while (q[i].empty()) i++;
    }
    int mr = q[i].top(), k;
    for (int j = i + 1; j <= q[i].top() && j <= n; j++) {
      if (q[j].size()) {
        if (q[j].top() > mr) {
          mr = q[j].top();
          k = j;
        }
      }
    }
    v[i] = 1;
    ans++;
    if (q[i].top() != mr) {
      i = k - 1;
    } else {
      i = q[i].top() + 1;
      while (q[i].empty() && i <= n) {
        i++;
      }
      i--;
    }
  }
  cout << m - ans << endl;
  for (int i = 1; i <= m; i++) {
    if (v[a[i]]) {
      if (a[i] + b[i] != q[a[i]].top())
        cout << i << " ";
      else
        v[a[i]] = 0;
    } else
      cout << i << " ";
  }
  return 0;
}
