You want the two images to be adjacent to each other in their different sizes? Or you want them to be adjacent but the same size as each other? Or you want to mix together the images like by transparency? Or you want to replace part of the first image by the second image?
If you want the two images to be adjacent to each other in their different sizes, then pad the edge of the first matrix with a band of as many zeros as matches the size of the second image, and then store the second image into the appropriate place in those zeros. Though you might have to use some value other than 0 (e.g., you might want the empty space to be white.)