Problem Statement

Given a linked list A of length N and an integer B.

You need to find the value of the Bth node from the middle towards the beginning of the Linked List A.

If no such element exists, then return -1.

NOTE:

Problem Constraints

Input Format

First argument is the head pointer of the linkedlist A.

Second argument is an integer B.

Output Format

Return an integer denoting the value of the Bth from the middle towards the head of the linked list A. If no such element exists, then return -1.

Example Input

Input 1:

 A = 3 -> 4 -> 7 -> 5 -> 6 -> 1 6 -> 15 -> 61 -> 16
 B = 3

Input 2:

 A = 1 -> 14 -> 6 -> 16 -> 4 -> 10
 B = 2