#include <bits/stdc++.h>
using namespace std;
int n, m;
bool debug = false;
int k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
int L, cnt;
vector<pair<pair<int, int>, int>> mp[100005 * 2];
vector<pair<int, int>> v;
int dis[100005 * 2], pre[100005 * 2], preid[100005 * 2];
bool used[100005 * 2];
void dij() {
  dis[0] = 0;
  priority_queue<pair<int, int>, std::vector<pair<int, int>>,
                 std::greater<pair<int, int>>>
      q;
  q.push({0, 0});
  while (!q.empty()) {
    int x = q.top().second;
    q.pop();
    if (used[x]) continue;
    used[x] = 1;
    for (auto p : mp[x]) {
      int d = p.first.second, y = p.first.first, id = p.second;
      if (dis[x] + d < dis[y]) {
        dis[y] = dis[x] + d;
        q.push({dis[y], y});
        pre[y] = x;
        preid[y] = id;
      }
    }
  }
  printf("%d\n", dis[cnt - 1]);
  vector<int> ans;
  int cur = cnt - 1;
  while (1) {
    if (preid[cur] != 0) ans.push_back(preid[cur]);
    cur = pre[cur];
    if (cur == 0) break;
  }
  printf("%d\n", ans.size());
  for (auto it = ans.rbegin(); it != ans.rend(); it++) {
    printf("%d ", *it);
  }
}
int main() {
  scanf("%d%d", &n, &L);
  v.push_back({0, 0});
  cnt = 1;
  for (int i = 0, x, d, t, p; i < n; i++) {
    scanf("%d%d%d%d", &x, &d, &t, &p);
    if (x - p >= 0) {
      v.push_back({x - p, cnt++});
      dis[cnt - 1] = 1 << 30;
      v.push_back({x + d, cnt++});
      dis[cnt - 1] = 1 << 30;
      mp[cnt - 2].push_back({{cnt - 1, t + p}, i + 1});
    }
  }
  dis[cnt] = 1 << 30;
  v.push_back({L, cnt++});
  sort(v.begin(), v.end());
  for (int i = 0; i < cnt - 1; i++) {
    int x = v[i].second, y = v[i + 1].second;
    mp[x].push_back({{y, v[i + 1].first - v[i].first}, 0});
    mp[y].push_back({{x, v[i + 1].first - v[i].first}, 0});
  }
  dij();
  return 0;
}
