s = list(map(int, input().split()))
k = int(input())
s.sort()
print(s)if s:m = 0 # 统计找到的不存在的数的个数res = 0 # 累值t = 1 # 当前数i = 0 # 列表中当前下标while True:if i < len(s) and s[i] == t: # 如果当前数存在i += 1else: # 当前数不存在res = (res + t) % 1000000007 # 累值m += 1t += 1 # 当前数加一if m == k: # 找到了k个不存在的数break
else:res = sum(range(k + 1)) % 1000000007print(res)