When the monitor is connected, the dock should change its position it is necessary that when the second monitor is connected, the dock becomes from the bottom (without the monitor on the left) and the programs should open from the monitor being launched.
In System preferences -> Displays -> tab Arrangement, you can drag and drop the menu bar (white rectangle) to the desktop you want to be the master. System remembers that and everytime the same display model is connected it sets up automatically.



If you want to see the dock on the other screen, run the mouse pointer to the bottom of the screen and hold it there, the dock should move.