#include <bits/stdc++.h>
using namespace std;
int n, m, nxt[100010], pre[100010];
pair<int, int> b[100010];
struct Frog {
  int p, a, id;
} a[100010];
set<pair<int, int> > s;
inline bool operator<(Frog a, Frog b) { return a.p < b.p; }
inline int cal(int i, int j) {
  if (i == j) return 0x7fffffff;
  int p1 = a[i].p, p2 = a[j].p;
  if (i > j) (p2 += a[j].a) %= m;
  int d = (p2 - p1 + m) % m, step = (a[i].a - a[j].a);
  if (d <= a[i].a) return 1;
  if (a[j].a >= a[i].a) return 0x7fffffff;
  return (d - a[j].a + step - 1) / step;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++)
    scanf("%d%d", &a[i].p, &a[i].a), a[i].p--, b[i] = make_pair(a[i].p, i);
  sort(b, b + n);
  for (int i = 0; i < n; i++) {
    nxt[b[i].second] = b[(i + 1) % n].second;
    pre[b[(i + 1) % n].second] = b[i].second;
  }
  for (int i = 0; i < n; i++) s.insert(make_pair(cal(i, nxt[i]), i));
  while (!s.empty()) {
    set<pair<int, int> >::iterator it = s.begin();
    int i = it->second;
    if (it->first == 0x7fffffff) break;
    s.erase(it);
    s.erase(make_pair(cal(nxt[i], nxt[nxt[i]]), nxt[i]));
    s.erase(make_pair(cal(pre[i], i), pre[i]));
    a[i].p += cal(i, nxt[i]);
    a[i].a--;
    nxt[i] = nxt[nxt[i]];
    pre[nxt[i]] = i;
    s.insert(make_pair(cal(pre[i], i), pre[i]));
    s.insert(make_pair(cal(i, nxt[i]), i));
  }
  printf("%d\n", s.size());
  for (set<pair<int, int> >::iterator it = s.begin(); it != s.end(); it++)
    printf("%d ", it->second + 1);
  return 0;
}
