#include <bits/stdc++.h>
using namespace std;
struct frog {
  long long ind;
  long long sp;
  long long pos;
  long long time;
  long long wait;
  long long next;
  long long prev;
};
vector<frog> frogs;
long long m;
long long n;
const long long inf = 1000000000000000000;
long long ceil(const long long &a, const long long &b) {
  return (a + b - 1) / b;
}
bool compare(const frog &a, const frog &b) { return (a.pos < b.pos); }
long long find_wait(const int &j) {
  frog a = frogs[j], b = frogs[frogs[j].next];
  if (a.ind == b.ind) {
    return inf;
  }
  long long dist = (b.pos - a.pos + m) % m;
  long long t = max(a.time, b.time);
  if (a.time > b.time)
    dist = (dist + (a.time - b.time) * b.sp) % m;
  else
    dist = ((dist - (b.time - a.time) * a.sp) % m + m) % m;
  if (a.time < b.time && a.ind > b.ind && dist + a.sp > m) return b.time;
  if (a.ind < b.ind && dist <= a.sp) return t + 1;
  if (a.sp <= b.sp) return inf;
  if (a.ind < b.ind)
    return t + ceil(dist - a.sp, a.sp - b.sp) + 1;
  else
    return t + ceil(dist, a.sp - b.sp);
}
void solve() {
  sort(frogs.begin(), frogs.end(), compare);
  map<pair<long long, long long>, long long> alive;
  for (int i = 0; i < n; ++i) {
    frogs[i].next = (i + 1) % n;
    frogs[(i + 1) % n].prev = i;
    frogs[i].wait = find_wait(i);
    alive[pair<long long, long long>(frogs[i].wait, frogs[i].ind)] = i;
  }
  long long t = alive.begin()->first.first;
  while (t < inf) {
    long long j = alive.begin()->second;
    long long sp_change = 0;
    while (find_wait(j) == t) {
      alive.erase(pair<long long, long long>(frogs[frogs[j].next].wait,
                                             frogs[frogs[j].next].ind));
      ++sp_change;
      frogs[j].next = frogs[frogs[j].next].next;
    }
    frogs[frogs[j].next].prev = j;
    frogs[j].pos = (frogs[j].pos + (t - frogs[j].time) * frogs[j].sp) % m;
    frogs[j].sp = frogs[j].sp - sp_change;
    frogs[j].time = t;
    alive.erase(pair<long long, long long>(frogs[j].wait, frogs[j].ind));
    frogs[j].wait = find_wait(j);
    alive[pair<long long, long long>(frogs[j].wait, frogs[j].ind)] = j;
    long long k = frogs[j].prev;
    alive.erase(pair<long long, long long>(frogs[k].wait, frogs[k].ind));
    frogs[k].wait = find_wait(k);
    alive[pair<long long, long long>(frogs[k].wait, frogs[k].ind)] = k;
    t = alive.begin()->first.first;
  }
  vector<long long> ans;
  for (map<pair<long long, long long>, long long>::iterator it = alive.begin();
       it != alive.end(); ++it) {
    ans.push_back(it->first.second);
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << "\n";
  for (unsigned i = 0; i < ans.size(); ++i) cout << ans[i] << " ";
  cout << "\n";
  return;
}
int main() {
  cin >> n >> m;
  frog f;
  f.time = 0;
  for (int i = 0; i < n; ++i) {
    f.ind = i + 1;
    cin >> f.pos >> f.sp;
    frogs.push_back(f);
  }
  solve();
  return 0;
}
