You need both approaches at the same time, and a third approach as well (together with the other two).
1) Tell them in clear and no uncertain terms that it cannot be done in the time they want, and why.
Otherwise, they could later use you as... a sacrificial goat. They could put the blame on you, through complaining that you did not warn them ahead of time.
If a manager thinks that his position might be endangered, he will throw any of his underlings under the bus without a second thought. And if your manager was one of actually honest and good ones... well then you probably wouldn't have been in your situation in the first place.
You need a >> written << (email or something) record that you did warn them.
2) Accept the task, after doing the (1), as in, telling them it cannot be done in time. You want to keep your side of the bargain as much as possible - not only because of professionalism, but also to keep yourself free of any blame that might result. You do all you can, but never ever let them think that it will actually be done in the time frame they asked for.
3) If they turn to be unreasonable, start looking for another job, while doing your best at the job you have. If they don't want to accept the fact - that their wishes are impossible - don't tell them that you will quit. Just suck it up and quietly look for another job.
If they don't want to accept the reality of the situation, then the only other info they should get from you is your two weeks notice after you have the next job locked in (as in, an offer on paper, signed by both sides, and with the start date and everything else agreed upon).