Untwist the yarn tail…
…and split the yarn end into two thinner strands.
Thread one strand on a small sharp needle and weave it in one direction following the stitch path of the pattern (for an inch or two). Make sure to take the needle through the middle of the last knitted stitch before you stop weaving – this splits the yarn and locks it in place.
Before you trim off the excess, stretch your fabric a bit. Then cut off the tail.
Do the same with the other yarn tail, except go in the opposite direction.