Hi, I don't have 40lbs to lose, but I started at that point
I have maintained that loss for 7 years except during pregnancy (and back to pre-pregnancy in about 6 months). The key was to stick to the proper calories, no matter what, for over a year, and it came off. It was not easy, but it worked. And to stay with that level of dedication for life. When I went out with friends (I was 20 when I started), it was plain chicken burgers and vodka with diet coke. At home, it was chicken, rice, broccoli (with lots of seasoning and spices). I did hard cardio 4x a week and eventually got into weight lifting.
Good luck, you can do this. It's a formidable number "40", but it's not impossible. What are you struggling with? I know it's getting started, is it a struggle with finding the right plan?