ur cnt value getting more than ur array value, if u set 10 items in array it means 0-9 only, so ur cnt value shuld be with in that limit.