Josephson junction of finite-size superconductors on a topological insulator under a magnetic field