You have not given exactly what kind of pills, how many, or much other information.  However, what I can tell you is that any time child endangerment is involved the penalty is always much more severe - whether or not it is for a first-offense.  Right now you need to speak with a criminal defense attorney.  You never know, they might be able to get the charge dismissed due to a technicality or at least get it reduced.  To some degree being a first time offender still helps but again child endangerment is most seriously dealt with by the criminal justice system.If you can't afford an attorney, ask for a PD to be appointed or contact Legal Aid.  Also, check to see if there is a law school nearby to where you live; they typically run free/low cost clinics that handle these type cases.  Additionally, you can, contact the local Bar Association in your county; they may have a list of attorneys who will take your case "pro bono" (for free) or at least for a reduced fee based on your income/circumstances.