#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1000000007;
const long long BIG = 1446803456761533460LL;
const int Big = 336860180;
const long long int INF = LONG_LONG_MAX;
const vector<vector<long long int> > adj4({{0, 1}, {0, -1}, {1, 0}, {-1, 0}});
const vector<vector<long long int> > adj8(
    {{0, 1}, {0, -1}, {1, 0}, {-1, 0}, {-1, -1}, {1, -1}, {-1, 1}, {1, 1}});
long long int gcd(long long int a, long long int b) {
  return b == 0 ? a : gcd(b, a % b);
}
bool isprime(long long int n) {
  if (n == 2 || n == 3) return true;
  if (n < 2 || n % 2 == 0 || n % 3 == 0) return false;
  for (long long int i = 6; (i - 1) * (i - 1) <= n; i += 6) {
    if (n % (i - 1) == 0 || n % (i + 1) == 0) {
      return false;
    }
  }
  return true;
}
vector<bool> sprime;
void genPrime(long long int sz) {
  sprime = vector<bool>(sz, true);
  sprime[0] = false;
  sprime[1] = false;
  for (long long int i = (2); i < (sz); ++i) {
    if (sprime[i]) {
      for (long long int j = i * i; j < sz; j += i) {
        sprime[j] = false;
      }
    }
  }
}
long long int powMod(long long int a, long long int b, long long int mod) {
  long long int n = 1;
  long long int p = a;
  while (b > 0) {
    if (b % 2 == 1) {
      n *= p;
      n %= mod;
    }
    p *= p;
    p %= mod;
    b /= 2;
  }
  return n;
}
long long int modularInverse(long long int a, long long int mod) {
  return powMod(a, mod - 2, mod);
}
long long int binarysearch(long long int l, long long int r,
                           bool (*bsfunction)(long long int)) {
  while (r - l > 1) {
    long long int mid = (l + r) / 2;
    bool val = bsfunction(mid);
    if (val) {
      r = mid;
    } else {
      l = mid;
    }
  }
  return l;
}
stringstream sss;
const long long int maxn = 100010;
map<long long int, vector<pair<long long int, long long int> > > g;
map<long long int, long long int> d;
map<long long int, pair<long long int, long long int> > par;
long long int W[maxn];
void MAIN() {
  long long int n, L;
  cin >> n >> L;
  g[0].clear();
  g[L].clear();
  for (long long int i = 0; i < (n); ++i) {
    long long int x, d, t, p;
    cin >> x >> d >> t >> p;
    if (x - p >= 0) g[x - p].push_back(make_pair(x + d, -i));
    g[x + d];
    W[i] = t + p;
  }
  for (auto x = g.begin(); x != g.end(); ++x) {
    if (x->first != L) {
      long long int xx = x->first;
      ++x;
      long long int yy = x->first;
      --x;
      x->second.push_back(make_pair(yy, yy - xx));
      ++x;
      x->second.push_back(make_pair(xx, yy - xx));
      --x;
    }
    d[x->first] = BIG;
  }
  set<pair<long long int, long long int> > st;
  d[0] = 0;
  st.insert(make_pair(d[0], 0));
  while (!st.empty()) {
    long long int x = st.begin()->second;
    st.erase(st.begin());
    for (auto y : g[x]) {
      long long int v = y.first;
      long long int w = y.second > 0 ? y.second : W[-y.second];
      if (d[x] + w < d[v]) {
        st.erase(make_pair(d[v], v));
        d[v] = d[x] + w;
        par[v] = make_pair(x, y.second > 0 ? -1 : -y.second);
        st.insert(make_pair(d[v], v));
      }
    }
  }
  vector<long long int> p;
  long long int x = L;
  while (x != 0) {
    if (par[x].second != -1) {
      p.push_back(par[x].second);
    }
    x = par[x].first;
  }
  cout << (d[L]) << endl;
  cout << (p.size()) << endl;
  if (p.empty()) return;
  for (long long int i = p.size() - 1; i >= 0; --i) {
    cout << p[i] + 1 << ' ';
  }
  cout << endl;
}
const long long int TESTCASEN = 1;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(10);
  sss << R"(
1 20
2 1 10 1
2 20
9 8 12 6
15 5 1 1
2 20
5 10 5 5
4 16 1 7
    )";
  for (long long int i = 0; i < (TESTCASEN); ++i) {
    MAIN();
  }
  return 0;
}
