Buggy python submission (verdict: Runtime Error):
N, T = list(map(int, input().split()))

t = list(map(int, input().split()))

if N == 1:
    print(T)
    exit(T)

ans = 0
buff = 0
for i in range(N):
    if T > t[i]:
        buff = t[i]
        if i == N-1:
            ans += buff
    elif T <= t[i]:
        if buff + T > t[i]:
            ans += t[i]
        elif buff + T < t[i]:
            ans += T + buff
        elif buff == t[i]:
            pass
        buff = 0

ans += T
print(ans)




Fixed submission:
N, T = list(map(int, input().split()))

t = list(map(int, input().split()))

if N == 1:
    print(T)
    exit()

# t.pop(0)
ans = 0
buff = 0
for i in range(N):
    if i != 0:
        if t[i] - t[i-1] < T:
            ans += t[i] - t[i-1]
        else:
            ans += T

ans += T
print(ans)

Buggy python submission (verdict: Runtime Error):
N, T = list(map(int, input().split()))

t = list(map(int, input().split()))

if N == 1:
    print(T)
    exit(T)

ans = 0
buff = 0
for i in range(N):
    if T > t[i]:
        buff = t[i]
        if i == N-1:
            ans += buff
    elif T <= t[i]:
        if buff + T > t[i]:
            ans += t[i]
        elif buff + T <= t[i]:
            ans += T + buff
        buff = 0

ans += T
print(ans)



Fixed submission:
N, T = list(map(int, input().split()))

t = list(map(int, input().split()))

if N == 1:
    print(T)
    exit()

# t.pop(0)
ans = 0
buff = 0
for i in range(N):
    if i != 0:
        if t[i] - t[i-1] < T:
            ans += t[i] - t[i-1]
        else:
            ans += T

ans += T
print(ans)

Buggy python submission (verdict: Runtime Error):
N, T = list(map(int, input().split()))

t = list(map(int, input().split()))

if N == 1:
    print(T)
    exit(T)

ans = 0
buff = 0
for i in range(N):
    if T > t[i]:
        buff = t[i]
        if i == N-1:
            ans = buff
    elif T <= t[i]:
        if buff + T > t[i]:
            ans += t[i]
        elif buff + T <= t[i]:
            ans += T + buff
        buff = 0

ans += T
print(ans)



Fixed submission:
N, T = list(map(int, input().split()))

t = list(map(int, input().split()))

if N == 1:
    print(T)
    exit()

# t.pop(0)
ans = 0
buff = 0
for i in range(N):
    if i != 0:
        if t[i] - t[i-1] < T:
            ans += t[i] - t[i-1]
        else:
            ans += T

ans += T
print(ans)

Buggy python submission (verdict: Runtime Error):
N, T = list(map(int, input().split()))

t = list(map(int, input().split()))

if N == 1:
    print(T)
    exit(T)

ans = 0
buff = 0
for i in range(N):
    if T > t[i]:
        buff = t[i]

    elif T <= t[i]:
        if buff + T > t[i]:
            ans += t[i]
        elif buff + T <= t[i]:
            ans += T + buff
        buff = 0

ans += T
print(ans)



Fixed submission:
N, T = list(map(int, input().split()))

t = list(map(int, input().split()))

if N == 1:
    print(T)
    exit()

# t.pop(0)
ans = 0
buff = 0
for i in range(N):
    if i != 0:
        if t[i] - t[i-1] < T:
            ans += t[i] - t[i-1]
        else:
            ans += T

ans += T
print(ans)

Buggy python submission (verdict: Runtime Error):
N, T = list(map(int, input().split()))

t = list(map(int, input().split()))

if N == 1:
    print(T)
    exit(T)

# t.pop(0)
ans = 0
buff = 0
for i in range(N):
    if t[i] <= T:
        buff = t[i] + T

        if N - 1 > i:
            if t[i+1] < buff:
                buff = t[i+1]

    elif t[i] > T:
        ans += buff + T
        buff = 0

print(max(ans, buff))

Fixed submission:
N, T = list(map(int, input().split()))

t = list(map(int, input().split()))

if N == 1:
    print(T)
    exit()

# t.pop(0)
ans = 0
buff = 0
for i in range(N):
    if i != 0:
        if t[i] - t[i-1] < T:
            ans += t[i] - t[i-1]
        else:
            ans += T

ans += T
print(ans)

Buggy python submission (verdict: Runtime Error):
N, T = list(map(int, input().split()))

t = list(map(int, input().split()))

if N == 1:
    print(T)
    exit(T)

# t.pop(0)
ans = 0
buff = 0
for i in range(N):
    if t[i] <= T:
        buff = t[i] + T

        if N - 1 > i:
            if t[i+1] < buff:
                buff = t[i+1]

    elif t[i] > T:
        ans += buff + T
        buff = 0

print(max(ans, buff))

Fixed submission:
N, T = list(map(int, input().split()))

t = list(map(int, input().split()))

if N == 1:
    print(T)
    exit()

# t.pop(0)
ans = 0
buff = 0
for i in range(N):
    if i != 0:
        if t[i] - t[i-1] < T:
            ans += t[i] - t[i-1]
        else:
            ans += T

ans += T
print(ans)

Buggy python submission (verdict: Runtime Error):
N, T = list(map(int, input().split()))

t = list(map(int, input().split()))

if N == 1:
    print(T)
    exit(T)

# t.pop(0)
ans = 0
buff = 0
for i in range(N):
    print(buff)
    if t[i] <= T:
        buff = t[i] + T

        if N - 1 > i:
            if t[i+1] < buff:
                buff = t[i+1]
        if i == N-1:
            print(buff)

    elif t[i] > T:
        ans += buff + T
        buff = 0

print(max(ans, buff))

Fixed submission:
N, T = list(map(int, input().split()))

t = list(map(int, input().split()))

if N == 1:
    print(T)
    exit()

# t.pop(0)
ans = 0
buff = 0
for i in range(N):
    if i != 0:
        if t[i] - t[i-1] < T:
            ans += t[i] - t[i-1]
        else:
            ans += T

ans += T
print(ans)