#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
int x[N], d[N], t[N], p[N];
vector<tuple<int, int, int> > g[N];
long long dis[N];
pair<int, int> pre[N];
void spfa(int S, int n) {
  priority_queue<pair<long long, int> > stk;
  fill_n(dis, n, LLONG_MAX);
  dis[S] = 0;
  stk.push({-dis[S], S});
  while (!stk.empty()) {
    auto u = stk.top();
    stk.pop();
    u.first = -u.first;
    if (dis[u.second] != u.first) continue;
    for (auto e : g[u.second]) {
      int v, w, id;
      tie(v, w, id) = e;
      if (dis[v] > u.first + w) {
        dis[v] = u.first + w;
        pre[v] = {u.second, id};
        stk.push({-dis[v], v});
      }
    }
  }
}
int n, L;
int main() {
  scanf("%d%d", &n, &L);
  vector<int> tx;
  tx.push_back(0);
  tx.push_back(L);
  for (int i = (0); i < (n); ++i) {
    scanf("%d%d%d%d", x + i, d + i, t + i, p + i);
    if (x[i] - p[i] >= 0) {
      tx.push_back(x[i] - p[i]);
      tx.push_back(x[i] + d[i]);
    }
  }
  sort((tx).begin(), (tx).end());
  tx.erase(unique((tx).begin(), (tx).end()), tx.end());
  for (int i = (0); i < (((int)(tx).size()) - 1); ++i) {
    g[i].push_back(make_tuple(i + 1, tx[i + 1] - tx[i], -1));
    g[i + 1].push_back(make_tuple(i, tx[i + 1] - tx[i], -1));
  }
  for (int i = (0); i < (n); ++i) {
    if (x[i] - p[i] >= 0) {
      int a = lower_bound((tx).begin(), (tx).end(), x[i] - p[i]) - tx.begin();
      int b = lower_bound((tx).begin(), (tx).end(), x[i] + d[i]) - tx.begin();
      g[a].push_back(make_tuple(b, t[i] + p[i], i));
    }
  }
  spfa(0, ((int)(tx).size()));
  vector<int> ans;
  for (int u = ((int)(tx).size()) - 1; u; u = pre[u].first) {
    if (~pre[u].second) ans.push_back(pre[u].second);
  }
  printf("%lld\n", dis[((int)(tx).size()) - 1]);
  printf("%d\n", ((int)(ans).size()));
  for (int i = (((int)(ans).size())) - 1; i >= (0); --i) {
    printf("%d\n", ans[i] + 1);
  }
  return 0;
}
