Write a C program to find the first repeating element in an array of N elements where values are in the range 0 to N-1.
Implement the equivalent function in Python. Given nums, return the first value encountered whose occurrence repeats during a left-to-right scan, or -1 if every value is unique. The input is a list of integers, and the output is an integer.
def first_repeating_element(nums):