We present a new algorithm of the finite element method (FEM) implemented as KANTBP 5M code in MAPLE for solving boundary-value problems (BVPs) for systems of second-order ordinary differential equations with continuous or piecewise continuous real or complex-valued coefficients. The desired solution in a finite interval of the real-valued independent variable is subject to mixed homogeneous boundary conditions (BCs). To reduce a BVP or a scattering problem with different numbers of asymptotically coupled or entangled open channels in the two asymptotic regions to a BVP on a finite interval, the asymptotic BCs for large absolute values of the independent variable are approximated by homogeneous Robin BCs. The BVP is discretized by means of the FEM using the Hermite interpolation polynomials with arbitrary multiplicity of the nodes, which preserves the continuity of derivatives of the desired solutions. The relevant algebraic problems are solved using the built-in linear algebra procedures. To calculate metastable states with complex eigenvalues of energy or to find bound states with the BCs depending on a spectral parameter, the Newton iteration scheme is implemented. Benchmark examples of the code application to BVPs and scattering problems of quantum mechanics are given. © 2021, Springer Nature Switzerland AG.