#include <bits/stdc++.h>
using namespace std;
int n, L;
int x[100010], d[100010], t[100010], p[100010], f[100010], par[100010];
int dp1[100010], dp2[100010];
bool cmp(const int &a1, const int &a2) {
  return (x[a1] - p[a1]) < x[a2] - p[a2];
}
int main() {
  scanf("%d%d", &n, &L);
  for (int i = 1; i <= n; i++) scanf("%d%d%d%d", &x[i], &d[i], &t[i], &p[i]);
  for (int i = 1; i <= n; i++) f[i] = i;
  sort(f + 1, f + n + 1, cmp);
  int res = L, pR = 0;
  set<pair<int, int> > pas, nex, SET;
  for (int ii = 1; ii <= n; ii++) {
    int i = f[ii];
    if (x[i] - p[i] < 0) continue;
    int pp = x[i] - p[i];
    int dd = x[i] + d[i];
    while (!SET.empty()) {
      pair<int, int> now = *SET.begin();
      if (now.first <= pp) {
        SET.erase(now);
        nex.erase(pair<int, int>(dp2[now.second], now.second));
        pas.insert(pair<int, int>(dp1[now.second], now.second));
      } else
        break;
    }
    int DP = pp;
    if ((!pas.empty()) && pas.begin()->first + pp < DP) {
      DP = pas.begin()->first + pp;
      par[i] = pas.begin()->second;
    }
    if ((!nex.empty()) && nex.begin()->first - pp < DP) {
      DP = nex.begin()->first - pp;
      par[i] = nex.begin()->second;
    }
    DP += p[i] + t[i];
    dp1[i] = DP - dd;
    dp2[i] = DP + dd;
    SET.insert(pair<int, int>(x[i] + d[i], i));
    nex.insert(pair<int, int>(dp2[i], i));
    if (DP + L - dd < res) {
      res = DP + L - dd;
      pR = i;
    }
  }
  vector<int> ramp;
  while (pR) {
    ramp.push_back(pR);
    pR = par[pR];
  }
  cout << res << endl;
  cout << ramp.size() << endl;
  for (int i = 0; i < (int)ramp.size(); i++)
    cout << ramp[(int)ramp.size() - i - 1] << ' ';
  cout << endl;
  return 0;
}
