Trust
A large group of people has decided to tackle a set of problems. Each individual in the group is initially assigned a certain number of problems. Among these individuals, there exists a special relationship known as trust. This means one person can delegate some of their problems to another, but not the other way around. These trust relationships are so reliable that a problem can be reassigned multiple times. The group is so interconnected that it is crucial to determine the minimum possible number of problems that the most burdened individual (the one with the highest number of problems) will have after optimally redistributing the problems.
Input
The input begins with two numbers, N and K (1 ≤ N ≤ 100, 0 ≤ K ≤ N·(N-1)/2), representing the number of people and the number of trust relationships, respectively. Following this, there are N numbers in a single line (1 ≤ v_i ≤ 10^6), which denote the initial number of problems each person has. Then, K lines follow, each containing two numbers, a and b (1 ≤ a, b ≤ N), indicating that person a can trust their problems to person b.
Output
Output a single number, which is the number of problems the most burdened person has after the optimal redistribution.