Generate a python program that has the following intention (give me code only):

The intention of the program is to find the longest increasing subsequence (LIS) of an array. The LIS problem is a classic problem in computer science, and the solution provided in the program is a dynamic programming approach.

The function lis(array) takes an array of numbers as input and returns the length of the longest increasing subsequence. The function initializes the ends dictionary to store the index of the last element in the current longest increasing subsequence.

The loop iterates through each element in the array and checks if the element is less than the current value in ends[i]. If it is, it means that the subsequence starting from element i is increasing. The prefix_lengths list stores the lengths of all increasing subsequences starting from element i that are less than the current element.

The maximum value of prefix_lengths is stored in length, and it represents the length of the current longest increasing subsequence. If the current element is greater than or equal to the value in ends[i], it means that the current element cannot be part of the longest increasing subsequence, and the function moves on to the next element.

If the current length is equal to the current longest increasing subsequence length or if the current element is less than the value in ends[i], the function updates the longest increasing subsequence length and the index of the last element in the longest increasing subsequence.

The function returns the length of the longest increasing subsequence. The dynamic programming approach used in the program is an efficient solution to the LIS problem, and it can be used to solve various problems that require finding the longest increasing subsequence.