Under construction

Still being built. Things may change

Snowball Fight

Interview

Time limit1sMemory limit1024 MB

Summary
Count the friends Jonas can hit, where a snowball is blocked by any snowdrift between the two positions that is taller than the shorter of the two heights.
Level

Easy3 of 10

Topics
Array, Brute force
Solved
No attempts yet

Problem

Snow fell heavily overnight, so Jonas and his friends decided to have a snowball fight. Each of them took a position, and the battle is about to begin.

The battlefield is described by NN integers viv_i, which give the heights of the snowdrifts. The larger viv_i is, the taller the ii-th snowdrift is.

When Jonas throws a snowball from position AA, he can hit a friend at position BB if there is no snowdrift between them that is taller than min⁡(vA,vB)\min(v_A, v_B).

In the figure above, Jonas (position 5, height 5) can hit Manta (position 2, height 4), but he cannot hit Asta (position 7, height 2).

Given the battlefield and the positions of Jonas and his friends, count how many friends Jonas can hit by throwing snowballs.

Input

The first line contains three integers NN, MM, and AA. NN is the size of the battlefield, MM is the number of Jonas's friends (not counting Jonas), and AA is Jonas's position.

The second line contains NN integers v1,v2,…,vNv_1, v_2, \ldots, v_N. Each value is the height of the corresponding snowdrift.

The third line contains MM distinct integers B1,B2,…,BMB_1, B_2, \ldots, B_M in increasing order. Each value is the position of a friend.

Output

Print one integer: the number of friends Jonas can hit by throwing snowballs.

Constraints

  • 1≤N,M,vi≤200001 \le N, M, v_i \le 20000
  • 1≤A,Bi≤N1 \le A, B_i \le N

Examples2

  1. Example 1

    Input
    7 2 5
    1 4 3 2 5 3 2
    2 7
    
    Expected output
    1
    
  2. Example 2

    Input
    5 4 1
    3 3 3 3 3
    2 3 4 5
    
    Expected output
    4