#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
const int MAX = 1000005;
const long long INF = 1000000000000000005;
struct edge {
  int to, lbl;
  int w;
};
vector<int> G;
int x[N], d[N], t[N], p[N];
map<int, int> mp;
edge e[MAX];
vector<int> G2[MAX];
long long visited[MAX];
vector<int> res;
pair<int, int> par[MAX];
void add(int from, int to, int w, int lbl, int &i) {
  e[i].to = mp[to];
  e[i].lbl = lbl;
  e[i].w = w;
  G2[mp[from]].push_back(i);
  i++;
}
void bfs(int st) {
  priority_queue<pair<long long, int> > q;
  fill(visited, visited + N, INF);
  visited[st] = 0;
  par[st] = make_pair(-1, -1);
  q.push(make_pair(0, st));
  while (!q.empty()) {
    int tp = q.top().second;
    q.pop();
    for (int i = 0; i < G2[tp].size(); i++) {
      edge cur = e[G2[tp][i]];
      if (visited[tp] + cur.w < visited[cur.to]) {
        visited[cur.to] = visited[tp] + cur.w;
        par[cur.to] = make_pair(tp, cur.lbl);
        q.push(make_pair(-visited[cur.to], cur.to));
      }
    }
  }
}
int main() {
  int n, l;
  scanf("%d %d", &n, &l);
  G.push_back(0);
  G.push_back(l);
  for (int i = 0; i < n; i++) {
    scanf("%d %d %d %d", &x[i], &d[i], &t[i], &p[i]);
    G.push_back(x[i] - p[i]);
    G.push_back(x[i] + p[i]);
    G.push_back(x[i] + d[i]);
  }
  sort(G.begin(), G.end());
  G.erase(unique(G.begin(), G.end()), G.end());
  for (int i = 0; i < G.size(); i++) {
    mp[G[i]] = i;
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    add(x[i] - p[i], x[i] + d[i], p[i] + t[i], i, cnt);
  }
  for (int i = 0; i < G.size() - 1; i++) {
    add(G[i], G[i + 1], G[i + 1] - G[i], -1, cnt);
    if (!(G[i] < 0)) {
      add(G[i + 1], G[i], G[i + 1] - G[i], -1, cnt);
    }
  }
  bfs(mp[0]);
  printf("%I64d\n", visited[mp[l]]);
  int cur = mp[l];
  while (cur != mp[0]) {
    if (!(par[cur].second < 0)) {
      res.push_back(par[cur].second);
    }
    cur = par[cur].first;
  }
  printf("%d\n", res.size());
  for (int i = res.size() - 1; i > -1; i--) {
    printf("%d\n", res[i] + 1);
  }
  return 0;
}
