#include <bits/stdc++.h>
using namespace std;
int n, m, pre[100010], nex[100010], po[100010];
long long pi[100010], vi[100010], pt[100010];
bool dead[100010];
set<pair<long long, int> > tree;
bool cmp(int a, int b) { return pi[a] < pi[b]; }
long long check(int x, int y) {
  if (x == y) return 0;
  if (x > y && pt[x] < pt[y]) {
    long long px = (pi[x] + (pt[y] - pt[x] - 1) * vi[x]) % m;
    long long dlen = pi[y] - px;
    if (dlen < 0) dlen += m;
    if (dlen <= vi[x]) return pt[y];
  }
  long long px = pi[x], py = pi[y], tt, ck = 0;
  tt = max(pt[x], pt[y]);
  if (pt[x] < pt[y])
    px = (px + (pt[y] - pt[x]) * vi[x]) % m;
  else
    py = (py + (pt[x] - pt[y]) * vi[y]) % m;
  long long dlen = py - px, vv = vi[x] - vi[y];
  if (dlen < 0) dlen += m;
  if (y > x && vi[x]) {
    ++ck, dlen -= vi[x];
    if (dlen <= 0) return tt + 1;
  }
  if (vv <= 0) return 0;
  long long ans = dlen / vv;
  if (ans * vv < dlen) ++ans;
  return tt + ck + ans;
}
void init() {
  cin >> n >> m;
  memset(dead, 0, sizeof(dead));
  memset(pt, 0, sizeof(pt));
  for (int i = 1; i <= n; ++i) {
    scanf("%I64d%I64d", pi + i, vi + i);
    po[i] = i;
    --pi[i];
  }
  sort(po + 1, po + 1 + n, cmp);
  for (int i = 1; i <= n; ++i) {
    nex[po[i]] = po[i + 1];
    pre[po[i]] = po[i - 1];
  }
  nex[po[n]] = po[1];
  pre[po[1]] = po[n];
  for (int i = 1; i <= n; ++i) {
    long long nt = check(i, nex[i]);
    if (nt > 0) tree.insert(make_pair(nt, i));
  }
  set<pair<long long, int> >::iterator it;
  while (!tree.empty()) {
    long long tt, NT = tree.begin()->first;
    int x = tree.begin()->second;
    tree.erase(make_pair(NT, x));
    if (dead[x]) continue;
    tree.erase(make_pair(check(pre[x], x), pre[x]));
    int con = 0;
    while ((tt = check(x, nex[x])) && tt <= NT) {
      dead[nex[x]] = true;
      nex[x] = nex[nex[x]];
      pre[nex[x]] = x;
      ++con;
    }
    pi[x] = (pi[x] + vi[x] * (NT - pt[x])) % m;
    pt[x] = NT;
    vi[x] = max((long long)0, vi[x] - con);
    if ((tt = check(x, nex[x]))) tree.insert(make_pair(tt, x));
    if ((tt = check(pre[x], x))) tree.insert(make_pair(tt, pre[x]));
  }
  int sum = 0;
  for (int i = 1; i <= n; ++i)
    if (!dead[i]) ++sum;
  cout << sum << "\n";
  for (int i = 1; i <= n; ++i)
    if (!dead[i]) printf("%d ", i);
  return;
}
int main() {
  init();
  return 0;
}
