#include <bits/stdc++.h>
const double Pi = acos(-1.0);
using namespace std;
const int N = 100000;
const long long INF = 1000000000000000000LL;
int n, l, x[N], d[N], t[N], p[N];
const int V = (N + 1) << 1;
long long dist[V];
vector<pair<int, int> > edges[V];
vector<pair<int, int> > backup[V];
vector<pair<int, int> >::iterator back[V];
int main() {
  scanf("%d%d", &n, &l);
  vector<int> events;
  events.push_back(0);
  events.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) {
      events.push_back(x[i] - p[i]);
    }
    events.push_back(x[i] + d[i]);
  }
  sort(events.begin(), events.end());
  events.erase(unique(events.begin(), events.end()), events.end());
  for (int i = 0; i + 1 < (int)events.size(); ++i) {
    edges[i].push_back(make_pair(i + 1, events[i + 1] - events[i]));
    backup[i].push_back(make_pair(i, -1));
    edges[i + 1].push_back(make_pair(i, events[i + 1] - events[i]));
    backup[i + 1].push_back(make_pair(i + 1, -1));
  }
  for (int i = 0; i < n; ++i) {
    if (x[i] - p[i] >= 0) {
      int a = lower_bound(events.begin(), events.end(), x[i] - p[i]) -
              events.begin();
      int b = lower_bound(events.begin(), events.end(), x[i] + d[i]) -
              events.begin();
      edges[a].push_back(make_pair(b, t[i] + p[i]));
      backup[a].push_back(make_pair(a, i));
    }
  }
  fill(dist, dist + V, INF);
  dist[0] = 0;
  priority_queue<pair<long long, int> > heap;
  heap.push(make_pair(0, 0));
  while (!heap.empty()) {
    pair<long long, int> ret = heap.top();
    heap.pop();
    int u = ret.second;
    if (-ret.first != dist[u]) {
      continue;
    }
    for (int i = 0; i < (int)edges[u].size(); ++i) {
      vector<pair<int, int> >::iterator iter = edges[u].begin() + i;
      if (dist[u] + iter->second < dist[iter->first]) {
        dist[iter->first] = dist[u] + iter->second;
        back[iter->first] = backup[u].begin() + i;
        heap.push(make_pair(-dist[iter->first], iter->first));
      }
    }
  }
  vector<int> answer;
  cout << dist[(int)events.size() - 1] << '\n';
  for (int i = (int)events.size() - 1; i != 0; i = back[i]->first) {
    if (back[i]->second != -1) {
      answer.push_back(back[i]->second);
    }
  }
  reverse(answer.begin(), answer.end());
  printf("%d\n", (int)answer.size());
  for (int i = 0; i < (int)answer.size(); ++i) {
    printf("%d\n", answer[i] + 1);
  }
  return 0;
}
