241_A. Old Peykan
There are n cities in the country where the Old Peykan lives. These cities are located on a straight line, we'll denote them from left to right as c1, c2, ..., cn. The Old Peykan wants to travel from city c1 to cn using roads. There are (n - 1) one way roads, the i-th road goes from city ci to city ci + 1 and is di kilometers long.

The Old Peykan travels 1 kilometer in 1 hour and consumes 1 liter of fuel during this time.

Each city ci (except for the last city cn) has a supply of si liters of fuel which immediately transfers to the Old Peykan if it passes the city or stays in it. This supply refreshes instantly k hours after it transfers. The Old Peykan can stay in a city for a while and fill its fuel tank many times. 

Initially (at time zero) the Old Peykan is at city c1 and s1 liters of fuel is transferred to it's empty tank from c1's supply. The Old Peykan's fuel tank capacity is unlimited. Old Peykan can not continue its travel if its tank is emptied strictly between two cities.

Find the minimum time the Old Peykan needs to reach city cn.

Input

The first line of the input contains two space-separated integers m and k (1 ≤ m, k ≤ 1000). The value m specifies the number of roads between cities which is equal to n - 1.

The next line contains m space-separated integers d1, d2, ..., dm (1 ≤ di ≤ 1000) and the following line contains m space-separated integers s1, s2, ..., sm (1 ≤ si ≤ 1000).

Output

In the only line of the output print a single integer — the minimum time required for The Old Peykan to reach city cn from city c1.

Examples

Input

4 6
1 2 5 2
2 3 3 4


Output

10


Input

2 3
5 6
5 5


Output

14

Note

In the second sample above, the Old Peykan stays in c1 for 3 hours.
```python
# CF 241/A 1300

# S = supply in city i
# D = distance from c[i] to c[i + 1]
# k = refresh interval
# min time to arrive at C[n] where n = m + 1

def f(k, D, S):
    n = len(D)

    # travel time is at least the sum of all distances
    time = sum(D)

    fuel = 0
    best = 0

    for i in range(n):
        assert fuel >= 0
        # enter i-th city
        # fuel is either negative (we need extra) or zero
        # add S[i] fuel for free
        # subtract distance to city i+1
        fuel += (S[i] - D[i])
        if S[i] > S[best]:
            best = i
        if fuel < 0: # best station for i..lastpos
            need = -fuel
            count = need // S[best]
            if need % S[best] != 0:
                count += 1
            time += count * k
            fuel += S[best] * count

    return time

assert f(4, [15, 20, 14, 10, 39, 4, 26, 8, 8, 30, 13, 43, 7, 7, 4, 6, 23, 42, 24, 35, 12, 19, 21, 31, 5, 20, 8, 17, 25, 31, 8, 31, 9, 14, 29, 35, 39, 35, 19, 13, 35, 11, 24, 3, 22, 3, 22, 41, 26, 32, 17, 42, 21, 16, 15, 44, 12, 5, 16, 20, 19, 38, 15, 11, 36, 14, 6, 21, 5, 27, 15, 40, 6, 9, 32, 33, 35, 4, 10, 15, 26], [3, 5, 4, 3, 4, 6, 4, 7, 5, 4, 3, 4, 3, 3, 4, 3, 4, 3, 3, 4, 6, 5, 5, 3, 3, 6, 6, 5, 3, 3, 5, 3, 3, 6, 4, 4, 3, 6, 4, 3, 3, 5, 6, 6, 7, 3, 3, 3, 3, 3, 7, 3, 3, 5, 3, 3, 3, 4, 6, 4, 6, 4, 5, 3, 3, 6, 4, 3, 3, 3, 7, 5, 4, 5, 3, 5, 4, 3, 3, 4, 3]) == 2419

assert f(10, [4, 4, 4], [1, 2, 3]) == 3 * 10 + 1 * 10 + 10 + 12
assert f(10, [5], [5]) == 5
assert f(10, [6], [5]) == 16
assert f(20, [5, 5], [5, 5]) == 10
assert f(5,  [2, 2, 2], [1, 1, 1]) == 6 + 5 + 5 + 5
assert f(5,  [1, 1, 1], [3, 0, 0]) == 3
assert f(10, [4, 4, 4], [6, 5, 3]) == 12

assert f(6, [1, 2, 5, 2], [2, 3, 3, 4]) == 10
assert f(5, [10, 10, 10], [5, 10, 1]) == 40
assert f(3, [5, 6], [5, 5]) == 14
assert f(3, [11, 8, 8, 12, 17, 4, 4, 25, 39, 37, 31, 32, 38, 34, 29, 29, 34, 39, 39, 39, 17, 9, 24, 6], [3, 5, 4, 3, 3, 3, 4, 3, 4, 3, 3, 3, 3, 4, 3, 3, 4, 3, 4, 3, 3, 3, 3, 3]) == 862


m, k = map(int, input().split())
D = list(map(int, input().split()))
S = list(map(int, input().split()))
ans = f(k, D, S)
print(ans)

```