From 2011 facebook is organizing a Facebook hacker cup every year around feb, visit Facebook hacker cup homepage for more details

This question is the third question(Carried 45 marks out of 100) for the qualification round 2013 hacker cup.

## Problem Statement

After sending smileys, John decided to play with arrays. Did you know that hackers enjoy playing with arrays? John has a zero-based index array, **m**, which contains **n** non-negative integers. However, only the first **k** values of the array are known to him, and he wants to figure out the rest.

John knows the following: for each index **i**, where **k** <= **i** < **n, m**[**i**] is the minimum non-negative integer which is *not* contained in the previous ***k*** values of **m**.

[Read more…]