India and Pakistan have exchanged tough words over their failure to overcome key security differences at the end of a two-day summit of South Asian leaders in the Bangladeshi capital, Dhaka.