#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, m;
struct point {
  int a, v, num, ex;
} p[N];
struct pai {
  int time, num;
  pai(int _time = 0, int _num = 0) {
    time = _time;
    num = _num;
  }
  friend bool operator<(pai a, pai b) {
    return (a.time > b.time || (a.time == b.time && a.num > b.num));
  }
};
priority_queue<pai> q;
bool comp1(point a, point b) { return a.a < b.a; }
int add[N], adr[N];
int l[N], r[N];
vector<int> v;
int find(int x, int y) {
  if (x == y) return 0;
  int dis = (p[y].a - p[x].a + m) % m;
  dis += add[y] - add[x];
  int t = 0;
  if (p[x].num < p[y].num) {
    if (p[x].v >= dis) return 1;
    dis -= p[x].v;
    t = 1;
  }
  if (p[y].v >= p[x].v) return 0;
  if (dis <= 0) return 1;
  return (dis - 1) / (p[x].v - p[y].v) + t + 1;
}
int main() {
  int x, y, number;
  int round, knum;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &p[i].a, &p[i].v);
    p[i].num = i;
    p[i].ex = 1;
  }
  sort(p + 1, p + n + 1, comp1);
  for (int i = 1; i <= n; i++) adr[p[i].num] = i;
  for (int i = 1; i <= n; i++) {
    x = adr[i];
    y = x % n + 1;
    round = find(x, y);
    r[x] = y;
    l[y] = x;
    if (round) {
      q.push(pai(round, i));
    }
  }
  while (!q.empty()) {
    round = q.top().time;
    number = adr[q.top().num];
    q.pop();
    if (!p[number].ex || !p[r[number]].ex || find(number, r[number]) != round)
      continue;
    knum = 0;
    for (; find(number, r[number]) == round;) {
      p[r[number]].ex = 0;
      r[number] = r[r[number]];
      knum++;
    }
    p[number].v = max(p[number].v - knum, 0);
    l[r[number]] = number;
    add[number] += knum * round;
    round = find(number, r[number]);
    if (round) {
      q.push(pai(round, p[number].num));
    }
    round = find(l[number], number);
    if (round) {
      q.push(pai(round, p[l[number]].num));
    }
  }
  for (int i = 1; i <= n; i++)
    if (p[i].ex) v.push_back(p[i].num);
  sort(v.begin(), v.end());
  printf("%d\n", v.size());
  for (int i = 0; i < v.size() - 1; i++) printf("%d ", v[i]);
  printf("%d\n", v[v.size() - 1]);
  return 0;
}
