#include <bits/stdc++.h>
struct range {
  size_t a, l, id;
};
bool operator<(const range& lhs, const range& rhs) {
  return lhs.a + lhs.l < rhs.a + rhs.l;
}
std::istream& operator>>(std::istream& is, range& r) {
  return is >> r.a >> r.l;
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  size_t n, m;
  std::cin >> n >> m;
  std::vector<range> ranges(m);
  for (size_t i = 0; i < m; ++i) {
    std::cin >> ranges[i];
    ranges[i].id = i;
  }
  sort(ranges.begin(), ranges.end(),
       [](const range& lhs, const range& rhs) { return lhs.a < rhs.a; });
  std::priority_queue<range> q;
  std::vector<size_t> result;
  for (size_t ptr = 0; ptr < m;) {
    q.push(ranges[ptr]);
    ptr += 1;
    while (ptr < m && q.top().a == ranges[ptr].a) {
      q.push(ranges[ptr]);
      ptr += 1;
    }
    size_t last = 0;
    while (!q.empty()) {
      range r = q.top();
      q.pop();
      if (last >= r.a + r.l - 1) {
        result.push_back(r.id);
        continue;
      }
      last = r.a + r.l - 1;
      while (ptr < m && ranges[ptr].a <= last + 1) {
        q.push(ranges[ptr]);
        ptr += 1;
      }
    }
  }
  std::cout << result.size() << '\n';
  for (const size_t id : result) {
    std::cout << id + 1 << ' ';
  }
  std::cout << '\n';
}
