#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 85 - 69;
vector<pair<pair<long long int, int>, int> > adj[maxn];
long long int dist[maxn];
vector<int> positions, ans;
set<pair<long long int, long long int> > s;
int n, l;
int x[maxn], d[maxn], t[maxn], p[maxn], par[maxn], number[maxn];
bool unusable[maxn];
void Dijkstra(int source) {
  memset(dist, 127, sizeof dist);
  dist[source] = 0;
  s.insert(make_pair(0, source));
  while (s.size()) {
    int x = s.begin()->second;
    s.erase(s.begin());
    for (int i = 0; i < adj[x].size(); i++) {
      if (dist[x] + adj[x][i].second < dist[adj[x][i].first.first]) {
        s.erase(make_pair(dist[adj[x][i].first.first], adj[x][i].first.first));
        dist[adj[x][i].first.first] = dist[x] + adj[x][i].second;
        par[adj[x][i].first.first] = x;
        number[adj[x][i].first.first] = adj[x][i].first.second;
        s.insert(make_pair(dist[adj[x][i].first.first], adj[x][i].first.first));
      }
    }
  }
}
void make(int x) {
  if (number[x] != 0) ans.push_back(number[x]);
  if (x == 0) return;
  make(par[x]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> l;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> d[i] >> t[i] >> p[i];
    if (x[i] < p[i]) {
      unusable[i] = true;
      continue;
    }
    positions.push_back(x[i] - p[i]);
    positions.push_back(x[i] + d[i]);
  }
  positions.push_back(0);
  positions.push_back(l);
  sort(positions.begin(), positions.end());
  positions.resize(unique(positions.begin(), positions.end()) -
                   positions.begin());
  for (int i = 0; i + 1 < positions.size(); i++) {
    adj[i].push_back(
        make_pair(make_pair(i + 1, 0), positions[i + 1] - positions[i]));
    adj[i + 1].push_back(
        make_pair(make_pair(i, 0), positions[i + 1] - positions[i]));
  }
  for (int i = 0; i < n; i++)
    if (!unusable[i]) {
      int id_begin =
              lower_bound(positions.begin(), positions.end(), x[i] - p[i]) -
              positions.begin(),
          id_end =
              lower_bound(positions.begin(), positions.end(), x[i] + d[i]) -
              positions.begin();
      adj[id_begin].push_back(make_pair(make_pair(id_end, i + 1), p[i] + t[i]));
    }
  Dijkstra(0);
  cout << dist[positions.size() - 1] << endl;
  make(positions.size() - 1);
  cout << ans.size() << endl;
  for (int i = ans.size() - 1; i >= 0; i--) cout << ans[i] << ' ';
  cout << endl;
  return 0;
}
