Insert element in sorted array