#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e9;
const long long LINF = (long long)1e18;
const long double PI = 2 * acos((long double)0);
long long gcd(long long a, long long b) {
  long long r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long fpow(long long n, long long k, int p = MOD) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
  }
  return r;
}
void addmod(int& a, int val, int p = MOD) {
  if ((a = (a + val)) >= p) a -= p;
}
void submod(int& a, int val, int p = MOD) {
  if ((a = (a - val)) < 0) a += p;
}
const int maxn = 100010;
int n, m;
long long p[maxn];
long long q[maxn];
long long a[maxn];
long long d[maxn];
long long t[maxn];
long long z[maxn];
int del[maxn];
set<pair<long long, long long> > st1, st2;
void update(int idx, long long tms) {
  q[idx] += (tms - t[idx]) * a[idx];
  t[idx] = tms;
}
long long calc(int idx, long long tms) {
  return q[idx] + (tms - t[idx]) * a[idx];
}
void process(pair<long long, long long> e) {
  long long tms = e.first;
  int u = e.second;
  if (del[u]) return;
  set<pair<long long, long long> >::iterator it = st1.find(make_pair(p[u], u));
  vector<pair<long long, long long> > his;
  while (1) {
    if (++it == st1.end()) {
      it = st1.begin();
    }
    int nxt = it->second;
    if (nxt == u) break;
    long long r = p[u] < p[nxt] ? 0 : m;
    r += u < nxt ? 0 : a[nxt];
    if (calc(u, tms - 1) + a[u] < calc(nxt, tms - 1) + r) break;
    d[u]++;
    del[nxt] = 1;
    his.push_back(*it);
  }
  for (__typeof((his).begin()) it = (his).begin(); it != (his).end(); it++) {
    st1.erase(*it);
  }
}
void update(pair<long long, long long> e) {
  long long tms = e.first;
  int u = e.second;
  if (del[u]) return;
  set<pair<long long, long long> >::iterator it = st1.find(make_pair(p[u], u));
  if (++it == st1.end()) {
    it = st1.begin();
  }
  int nxt = it->second;
  if (a[u] && nxt != u) {
    st2.erase(make_pair(z[u], u));
    long long x = t[u], y = t[nxt];
    long long d = max(x, y);
    update(u, d);
    update(nxt, d);
    long long r = p[u] < p[nxt] ? 0 : m;
    r += u < nxt ? 0 : a[nxt];
    if (q[u] + a[u] >= q[nxt] + r) {
      z[u] = d + 1;
      st2.insert(make_pair(z[u], u));
    } else if (a[u] > a[nxt]) {
      z[u] = d + (q[nxt] + r - q[u] - a[nxt] - 1) / (a[u] - a[nxt]) + 1;
      st2.insert(make_pair(z[u], u));
    }
    update(u, x);
    update(nxt, y);
  }
  it = st1.find(make_pair(p[u], u));
  if (it == st1.begin()) {
    it = st1.end();
  }
  it--;
  int prv = it->second;
  if (prv != u) {
    st2.erase(make_pair(z[prv], prv));
    long long x = t[prv], y = t[u];
    long long d = max(x, y);
    update(prv, d);
    update(u, d);
    long long r = p[prv] < p[u] ? 0 : m;
    r += prv < u ? 0 : a[u];
    if (q[prv] + a[prv] >= q[u] + r) {
      z[prv] = d + 1;
      st2.insert(make_pair(z[prv], prv));
    } else if (a[prv] > a[u]) {
      z[prv] = d + (q[u] + r - q[prv] - a[u] - 1) / (a[prv] - a[u]) + 1;
      st2.insert(make_pair(z[prv], prv));
    }
    update(prv, x);
    update(u, y);
  }
}
void solve() {
  cin >> n >> m;
  for (int i = (0); i < (n); i++) {
    cin >> p[i] >> a[i];
    q[i] = p[i];
    st1.insert(make_pair(p[i], i));
  }
  for (int i = (0); i < (n); i++) {
    set<pair<long long, long long> >::iterator it =
        st1.find(make_pair(p[i], i));
    if (++it == st1.end()) {
      it = st1.begin();
    }
    int nxt = it->second;
    int r = p[i] < p[nxt] ? 0 : m;
    r += i < nxt ? 0 : a[nxt];
    if (p[i] + a[i] >= p[nxt] + r) {
      z[i] = 1;
      st2.insert(make_pair(z[i], i));
    } else if (a[i] > a[nxt]) {
      z[i] = (p[nxt] + r - p[i] - a[nxt] - 1) / (a[i] - a[nxt]) + 1;
      st2.insert(make_pair(z[i], i));
    }
  }
  while (int((st2).size())) {
    vector<pair<long long, long long> > v;
    for (__typeof((st2).begin()) it = (st2).begin(); it != (st2).end(); it++) {
      if (it->first > st2.begin()->first) break;
      v.push_back(*it);
    }
    for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++) {
      process(*it);
      st2.erase(*it);
    }
    for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++) {
      int u = it->second;
      update(u, it->first);
      a[u] = max(0LL, a[u] - d[u]);
      d[u] = 0;
    }
    for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++) {
      update(*it);
    }
  }
  cout << int((st1).size()) << "\n";
  for (__typeof((st1).begin()) it = (st1).begin(); it != (st1).end(); it++)
    cout << it->second + 1 << " ";
}
int main() {
  solve();
  return 0;
}
