#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const int inf = 1e9 + 7;
struct Edge {
  int u, v, next, dis, id;
  Edge(int u = -1, int v = -1, int next = -1, int dis = -1, int id = -1)
      : u(u), v(v), next(next), dis(dis), id(id) {}
} e[N * 4];
int head[N], total;
void init() {
  memset(head, -1, sizeof(head));
  total = 0;
}
void adde(int u, int v, int dis, int id) {
  e[total] = Edge(u, v, head[u], dis, id);
  head[u] = total++;
}
int sta[N], top;
int xx[N], dd[N], tt[N], pp[N];
int dis[N], vis[N];
int pre[N];
struct PP {
  int v, g;
  PP(int v = -1, int g = -1) : v(v), g(g) {}
  bool operator<(const PP& th) const { return g > th.g; }
};
void spfa() {
  priority_queue<PP> qq;
  memset(vis, 0, sizeof(vis));
  for (int i = 1; i < top; i++) dis[i] = inf;
  dis[0] = 0;
  qq.push(PP(0, 0));
  pre[0] = -1;
  while (!qq.empty()) {
    PP tmp = qq.top();
    qq.pop();
    int u = tmp.v;
    if (vis[u]) continue;
    vis[u] = 1;
    for (int i = head[u]; i != -1; i = e[i].next) {
      int v = e[i].v;
      if (dis[v] > dis[u] + e[i].dis) {
        dis[v] = dis[u] + e[i].dis;
        pre[v] = i;
        qq.push(PP(v, dis[v]));
      }
    }
  }
  printf("%d\n", dis[top - 1]);
  int t = top - 1;
  top = 0;
  while (pre[t] != -1) {
    if (e[pre[t]].id != -1) sta[top++] = e[pre[t]].id;
    t = e[pre[t]].u;
  }
  printf("%d\n", top);
  for (int i = top - 1; i >= 0; i--) {
    printf("%d", sta[i] + 1);
    if (i)
      printf(" ");
    else
      printf("\n");
  }
}
int main() {
  int n, L;
  while (scanf("%d%d", &n, &L) != EOF) {
    init();
    top = 0;
    for (int i = 0; i < n; i++) {
      scanf("%d%d%d%d", &xx[i], &dd[i], &tt[i], &pp[i]);
      if (xx[i] - pp[i] >= 0) sta[top++] = xx[i] - pp[i];
      sta[top++] = xx[i] + dd[i];
    }
    sta[top++] = 0;
    sta[top++] = L;
    sort(sta, sta + top);
    top = unique(sta, sta + top) - sta;
    for (int i = 0; i < n; i++) {
      if (xx[i] - pp[i] >= 0) {
        int x = lower_bound(sta, sta + top, xx[i] - pp[i]) - sta;
        int y = lower_bound(sta, sta + top, xx[i] + dd[i]) - sta;
        adde(x, y, tt[i] + pp[i], i);
      }
    }
    for (int i = 0; i < top - 1; i++) {
      adde(i, i + 1, sta[i + 1] - sta[i], -1);
      adde(i + 1, i, sta[i + 1] - sta[i], -1);
    }
    spfa();
  }
  return 0;
}
