In this study, ion acceleration from thin planar diamond-like carbon (DLC) and polystyrene (PS) foils irradiated by ultraintense (a0 = 200) and ultrashort (15 fs) laser pulses is investigated numerically. The effects of target composition and thickness on the acceleration of protons and carbon ions are reported by 1D3V particle-in-cell simulation code and compared with the analytical models of ion acceleration. In the analytical formalism, the acceleration criterion of ions with different charge-to-mass ratio (q/m) is obtained. This criterion is related to the potential difference through the electrostatic shock distortion and its velocity. According to this result, charged particles with large q/m ratio have a good chance to accelerate in front of the electrostatic shock field. It is shown that mono-energetic proton bunch with energies >1.5 GeV is produced by 20 nm DLC foil supported by 10 nm hydrogen layer. Finally nanometer PS foil is examined and 2.33 Gev protons with ∼1.5% energy spread are obtained for 50 nm thickness.