private static int first (final int[] array, int i, final int nodesToMove) {

		final int length = array.length;
		final int limit = i;
		int k = array.length - 2;

		while ((i >= nodesToMove) && ((array[i] % length) > limit)) {
			k = i;
			i -= (limit - i + 1);
		}
		i = Math.max (nodesToMove - 1, i);

		while (k > (i + 1)) {
			int temp = (i + k) >> 1;
			if ((array[temp] % length) > limit) {
				k = temp;
			} else {
				i = temp;
			}
		}

		return k;

	}