In a public bath, there is a shower which emits water for T seconds when the switch is pushed.
If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds.
Note that it does not mean that the shower emits water for T additional seconds.
N people will push the switch while passing by the shower.
The i-th person will push the switch t_i seconds after the first person pushes it.
How long will the shower emit water in total?

-----Constraints-----
 - 1 ≤ N ≤ 200,000
 - 1 ≤ T ≤ 10^9
 - 0 = t_1 < t_2 < t_3 < , ..., < t_{N-1} < t_N ≤ 10^9
 - T and each t_i are integers.

-----Input-----
Input is given from Standard Input in the following format:
N T
t_1 t_2 ... t_N

-----Output-----
Assume that the shower will emit water for a total of X seconds. Print X.

-----Sample Input-----
2 4
0 3

-----Sample Output-----
7

Three seconds after the first person pushes the water, the switch is pushed again and the shower emits water for four more seconds, for a total of seven seconds.
[{"code": "n,T = map(int,input().split())\nt = list(map(int,input().split()))\nans = 0\nfor i in range(n-1):\n    ans += min(T,t[i+1]-t[i])\nprint(ans+T)", "passed": true, "time": 0.14, "memory": 14340.0, "status": "done"}, {"code": "n, t = map(int, input().split())\nT = list(map(int, input().split()))\n\nans = 0\nfor i in range(1, n):\n    if T[i] - T[i - 1] >= t:\n        ans += t\n    else:\n        ans += T[i] - T[i - 1]\nprint(ans + t)", "passed": true, "time": 0.15, "memory": 14068.0, "status": "done"}, {"code": "import math\n\nn, t = list(map(int, input().split()))\na = list(map(int, input().split()))\nans = 0\na.append(math.inf)\nfor i in range(n):\n    ans += min(t, a[i + 1] - a[i])\nprint(ans)\n", "passed": true, "time": 0.35, "memory": 14160.0, "status": "done"}, {"code": "N,T = map(int,input().split())\nt = list(map(int,input().split()))\nans = 0\n\nfor i in range(N-1):\n  if t[i+1]-t[i] > T:\n    ans += T\n  else:\n    ans += t[i+1]-t[i]\n\nprint(T+ans)", "passed": true, "time": 0.92, "memory": 14180.0, "status": "done"}, {"code": "n, t = map(int, input().split())\nts = list(map(int, input().split()))\n\nans = 0\nnow = 0\nfor i in ts[1:]:\n    if i<=now+t:\n        ans += i-now\n    else:\n        ans += t\n    now = i\nprint(ans+t)", "passed": true, "time": 0.15, "memory": 14296.0, "status": "done"}, {"code": "n,t = map(int,input().split())\nT = list(map(int,input().split()))\n\ns = n * t\nfor i in range(1,n):\n    if T[i] - T[i-1] < t:\n        s -= (t-(T[i]-T[i-1]))\nprint(s)", "passed": true, "time": 0.22, "memory": 14092.0, "status": "done"}, {"code": "N, T = map(int,input().split())\nlsT = list(map(int,input().split()))\ntend = T\nans = T\nfor i in range(1,N):\n    if  lsT[i] <= tend:\n        ans += lsT[i]+T-tend\n        tend = lsT[i]+T\n    else:\n        ans += T\n        tend = lsT[i]+T\nprint(ans)", "passed": true, "time": 1.68, "memory": 14164.0, "status": "done"}, {"code": "N,T = map(int,input().split())\nt = list(map(int,input().split()))\nans = T\nfor i in range(N-1):\n    now = t[i+1]-t[i]\n    ans += min(now,T)\n\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14284.0, "status": "done"}, {"code": "N,T = map(int,input().split())\nL = list(map(int,input().split()))\nans = 0\nfor i in range(N-1):\n  ans += min(L[i+1]-L[i],T)\nprint(ans+T)", "passed": true, "time": 0.23, "memory": 14112.0, "status": "done"}, {"code": "N, T = [int(x) for x in input().split()]\nt_list = [int(x) for x in input().split()]\nt_s = t_e = ans = 0\nfor t in t_list:\n    if t > t_e:\n        ans += t_e - t_s\n        t_s = t\n    t_e = t + T\nans += t_e - t_s\nprint(ans)", "passed": true, "time": 0.15, "memory": 14248.0, "status": "done"}, {"code": "n, t = list(map(int, input().split()))\ntn = list(map(int, input().split()))\nres = t\nfor i in range(1, n):\n    tmp = min(tn[i] - tn[i - 1], t)\n    res += tmp\n\nprint(res)\n", "passed": true, "time": 1.67, "memory": 14172.0, "status": "done"}, {"code": "n, t = map(int, input().split())\nT = tuple(map(int, input().split()))\nans = 0\nfor i in range(0, n-1):\n    dt = T[i+1] - T[i]\n    ans += min(dt, t)\nprint(ans + t)", "passed": true, "time": 0.27, "memory": 14332.0, "status": "done"}, {"code": "N,T=map(int,input().split())\nt=list(map(int,input().split()))\nans=0\nfor i in range(1,N):\n    ans+=min(t[i]-t[i-1],T)\nprint(ans+T)", "passed": true, "time": 0.21, "memory": 14224.0, "status": "done"}, {"code": "N, T = map(int, input().split())\nX = list(map(int, input().split()))\nS = 0\nfor i in range(1, N):\n  if X[i]-X[i-1]>=T:\n    S += T\n  else:\n    S += X[i]-X[i-1]\nprint(S+T)", "passed": true, "time": 0.19, "memory": 14244.0, "status": "done"}, {"code": "N, T = map(int, input().split())\nt = list(map(int, input().split()))\n\nans = T\n\nfor i in range(N-1):\n    if t[i+1] - t[i] >= T:\n        ans += T\n    else: # t[i+1]-t[i]<T\n        ans += t[i+1] - t[i]\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14276.0, "status": "done"}, {"code": "n, t = map(int, input().split())\nl = list(map(int, input().split()))\nold = 0\nans = t\nfor i in range(1,n):\n    ans += l[i] + t - max(old + t,l[i])\n    old = l[i]\nprint(ans)", "passed": true, "time": 0.14, "memory": 14164.0, "status": "done"}, {"code": "import sys\ninput = sys.stdin.readline\n\nN,T = list(map(int,input().split()))\nt = list(map(int,input().split()))\nt_stop = []\nfor i in range(N):\n    t_stop.append(t[i]+T)\ncum_flow = T*N\nfor i in range(N-1):\n    cum_flow -= max(t_stop[i] - t[i+1],0)\nprint(cum_flow)\n", "passed": true, "time": 0.22, "memory": 14228.0, "status": "done"}, {"code": "import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10 ** 9)\nINF = 1 << 60\nMOD = 1000000007\n\n\ndef main():\n    N, T, *t = list(map(int, read().split()))\n\n    ans = 0\n    for i in range(N - 1):\n        if t[i] + T > t[i + 1]:\n            ans += t[i + 1] - t[i]\n        else:\n            ans += T\n    ans += T\n\n    print(ans)\n\n    return\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14160.0, "status": "done"}, {"code": "#\n# abc060 c\n#\nimport sys\nfrom io import StringIO\nimport unittest\n\n\nclass TestClass(unittest.TestCase):\n    def assertIO(self, input, output):\n        stdout, stdin = sys.stdout, sys.stdin\n        sys.stdout, sys.stdin = StringIO(), StringIO(input)\n        resolve()\n        sys.stdout.seek(0)\n        out = sys.stdout.read()[:-1]\n        sys.stdout, sys.stdin = stdout, stdin\n        self.assertEqual(out, output)\n\n    def test_\u5165\u529b\u4f8b_1(self):\n        input = \"\"\"2 4\n0 3\"\"\"\n        output = \"\"\"7\"\"\"\n        self.assertIO(input, output)\n\n    def test_\u5165\u529b\u4f8b_2(self):\n        input = \"\"\"2 4\n0 5\"\"\"\n        output = \"\"\"8\"\"\"\n        self.assertIO(input, output)\n\n    def test_\u5165\u529b\u4f8b_3(self):\n        input = \"\"\"4 1000000000\n0 1000 1000000 1000000000\"\"\"\n        output = \"\"\"2000000000\"\"\"\n        self.assertIO(input, output)\n\n    def test_\u5165\u529b\u4f8b_4(self):\n        input = \"\"\"1 1\n0\"\"\"\n        output = \"\"\"1\"\"\"\n        self.assertIO(input, output)\n\n    def test_\u5165\u529b\u4f8b_5(self):\n        input = \"\"\"9 10\n0 3 5 7 100 110 200 300 311\"\"\"\n        output = \"\"\"67\"\"\"\n        self.assertIO(input, output)\n\n\ndef resolve():\n    N, T = list(map(int, input().split()))\n    t = list(map(int, input().split()))\n\n    ans = T\n    for i in range(N-2, -1, -1):\n        ans += min(T, t[i+1]-t[i])\n\n    print(ans)\n\n\ndef __starting_point():\n    # unittest.main()\n    resolve()\n\n__starting_point()", "passed": true, "time": 0.22, "memory": 14412.0, "status": "done"}, {"code": "N, T = map(int, input().split())\nt_List = [int(x) for x in input().split()]\npre = 0\nans = T\nfor t in t_List:\n    if t - pre <= T:\n        ans += t - pre\n    else:\n        ans += T\n    pre = t\nprint(ans)", "passed": true, "time": 0.14, "memory": 14228.0, "status": "done"}, {"code": "# C - Sentou\ndef main():\n    n, t = map(int, input().split())\n    s = list(map(int, input().split()))\n    cnt = n*t\n\n    for i in range(n-1):\n        if s[i+1] - s[i] < t:\n            cnt -= s[i]+t-s[i+1]\n    else:\n        print(cnt)\n\n\nif __name__ ==  \"__main__\":\n    main()", "passed": true, "time": 0.14, "memory": 14236.0, "status": "done"}, {"code": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sun Sep 27 03:05:21 2020\n\n@author: liang\n\"\"\"\n\nN ,T = map(int,input().split())\n\ntime = [int(x) for x in input().split()]\n\nans = 0\nfor i in range(N-1):\n    ans += min(T, time[i+1]-time[i])\nans += T\nprint(ans)", "passed": true, "time": 0.14, "memory": 14300.0, "status": "done"}, {"code": "n,t = map(int, input().split())\nT = list(map(int, input().split()))\n\nprev,now,ans = T[0],0,0\n\nfor i in range(n):\n    if not i:\n        continue\n    now = T[i]\n    if now-prev > t:\n        ans += t\n    else:\n        ans += now-prev\n    prev = now\nans += t\nprint(ans)", "passed": true, "time": 0.14, "memory": 14248.0, "status": "done"}, {"code": "N, T = list(map(int, input().split()))\nt = list(map(int, input().split()))\nd = []\n\nfor i in range(N-1):\n  tmp = t[i+1] - t[i]\n  if tmp > T:\n    d.append(T)\n  else:\n    d.append(tmp)\n\nprint(sum(d)+T)", "passed": true, "time": 0.14, "memory": 14296.0, "status": "done"}, {"code": "n, t = map(int, input().split())\ntime = [int(i) for i in input().split()]\nsum = 0\nfor i in range(len(time)-1):\n    if (time[i+1]-time[i]) < t:\n        sum += (time[i+1]-time[i])\n    else:\n        sum += t\nprint(sum+t)", "passed": true, "time": 0.22, "memory": 14112.0, "status": "done"}, {"code": "n , t = map(int, input().split())\nlis = list(map(int, input().split()))\n\nans = t\nfor i in range(1, n):\n    if lis[i] - lis[i-1] >= t:\n        ans += t\n    else:\n        ans += lis[i] - lis[i-1]\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14072.0, "status": "done"}, {"code": "n, t = list(map(int, input().split()))\ntl = list(map(int, input().split()))\nans = 0\nfor i in range(1, n):\n    ans += min(tl[i]-tl[i-1], t)\nans += t\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14132.0, "status": "done"}, {"code": "N,T=map(int,input().split())\nt = list(map(int,input().split()))\n\nans=0\nfor i in range(N):\n  if i == 0:\n    start = t[i]\n    finish = t[i]+T\n    continue\n    \n  if t[i]<finish:\n    finish = t[i]+T\n    continue\n    \n  else:\n    ans += finish - start\n    start = t[i]\n    finish = t[i]+T\n    \nans += finish - start\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14204.0, "status": "done"}, {"code": "n, t = map(int, input().split())\nL = list(map(int, input().split()))\n\nans = 0\nfor i in range(n-1):\n    ans += min(t, L[i+1] - L[i])\nans += t\nprint(ans)", "passed": true, "time": 0.14, "memory": 14336.0, "status": "done"}, {"code": "n,t = map(int,input().split())\ntl = list(map(int,input().split()))\nans = 0\nfor i in range(1,n):\n    if tl[i] >= t and tl[i] - tl[i-1] >= t:\n        ans+=t\n    else:\n        ans+=tl[i] - tl[i-1]\nprint(ans+t)", "passed": true, "time": 0.16, "memory": 14228.0, "status": "done"}, {"code": "N,K = (int(T) for T in input().split())\nPer = [int(T) for T in input().split()]\nWat = 0\nfor X in range(0,N-1):\n    if Per[X]+K<=Per[X+1]:\n        Wat += K\n    else:\n        Wat += Per[X+1]-Per[X]\nprint(Wat+K)", "passed": true, "time": 0.15, "memory": 14120.0, "status": "done"}, {"code": "n, t = map(int, input().split())\ntn = [int(num) for num in input().split()]\n\nsum = 0\nfor i in range(len(tn)):\n  if i < len(tn)-1:\n    if tn[i]+t < tn[i+1]:\n      sum += t\n    else :\n      sum += tn[i+1] - tn[i]\n  else :\n    sum += t\n\nprint(sum)", "passed": true, "time": 0.23, "memory": 14104.0, "status": "done"}, {"code": "n,t=map(int,input().split())\nl=list(map(int,input().split()))\ns=0\npre_end=0\nfor tt in l:\n  time=t-max(0, pre_end - tt)\n  s+=time\n  pre_end=tt+t\nprint(s)", "passed": true, "time": 0.23, "memory": 14332.0, "status": "done"}, {"code": "from typing import List\n\n\ndef answer(N: int, T: int, t: List[int]) -> int:\n    ans = 0\n    for i in range(N - 1):\n        ans += min(T, t[i + 1] - t[i])\n    return ans + T\n\n\ndef main():\n    N, T = list(map(int, input().split()))\n    t = list(map(int, input().split()))\n    print((answer(N, T, t)))\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.21, "memory": 15236.0, "status": "done"}, {"code": "N, T = map(int, input().split())\ntime = list(map(int, input().split()))\n\ncnt = 0\nfor i in range(1,N):\n    cnt += min(T, time[i] - time[i-1])\nprint(cnt+T)", "passed": true, "time": 0.14, "memory": 14308.0, "status": "done"}, {"code": "n, t = map(int, input().split())\nlst = list(map(int, input().split())) + [10 ** 12]\nsec = 0\nfor i in range(n):\n  sec += min(t, lst[i + 1] - lst[i])\nprint(sec)", "passed": true, "time": 0.2, "memory": 14068.0, "status": "done"}, {"code": "n, t = map(int, input().split())\narr = list(map(int, input().split()))\n\ntotal = t\ntime = 0\nfor i in arr[1:]:\n    total += min(t, (i - time))\n    time = i\n\nprint(total)", "passed": true, "time": 0.17, "memory": 14176.0, "status": "done"}, {"code": "n, t = list(map(int, input().split()))\nl = list(map(int, input().split()))\nnow = 0\nlatest = 0\nans = 0\n\nfor i in l:\n    now = i\n    #print(now,latest,t)\n    if now-latest >= t:\n        ans += t\n    else:\n        ans += now-latest\n    \n    latest = now\nans += t\nprint(ans)\n", "passed": true, "time": 0.19, "memory": 14180.0, "status": "done"}, {"code": "N,T = map(int,input().split())\ntime = list(map(int,input().split()))\nans = 0\nfor i in range(N-1):\n    if time[i+1] - time[i] >= T:\n        ans += T\n    else:\n        ans += time[i+1] - time[i]\nprint(ans+T)", "passed": true, "time": 0.18, "memory": 14312.0, "status": "done"}, {"code": "n, t = map(int, input().split())\na = list(map(int, input().split()))\nans = 0\nfor i in range(1,n):\n  ans += min(a[i] - a[i-1],t)\nprint(ans+t)", "passed": true, "time": 0.18, "memory": 14100.0, "status": "done"}, {"code": "n,T=map(int,input().split())\nt=list(map(int,input().split()))\nans=0\nfor i in range(n-1):\n    if t[i+1]-t[i]>T:\n        ans+=T\n    else:\n        ans+=t[i+1]-t[i]\nprint(ans+T)", "passed": true, "time": 0.16, "memory": 14176.0, "status": "done"}, {"code": "N,T=map(int,input().split())\nt=list(map(int,input().split()))\nans=0\nfor i in range(1,N):\n  d=t[i]-t[i-1]\n  if d < T:\n    ans+=d\n  else:\n    ans+=T\nprint(ans+T)", "passed": true, "time": 0.16, "memory": 14088.0, "status": "done"}, {"code": "n,t=map(int,input().split());a=list(map(int,input().split()))\nprint(sum([min(t,a[i]-a[i-1]) for i in range(1,n)])+t)", "passed": true, "time": 0.14, "memory": 14100.0, "status": "done"}, {"code": "import sys\n\nsys.setrecursionlimit(10 ** 8)\nini = lambda: int(sys.stdin.readline())\ninl = lambda: [int(x) for x in sys.stdin.readline().split()]\nins = lambda: sys.stdin.readline().rstrip()\ndebug = lambda *a, **kw: print(\"\\033[33m\", *a, \"\\033[0m\", **dict(file=sys.stderr, **kw))\n\n\ndef solve():\n    n, T = inl()\n    t = inl()\n    assert len(t) == n\n    assert t[0] == 0\n    p = 0\n    ans = 0\n    for i in range(1, n):\n        x = t[i]\n        ans += min(x - p, T)\n        p = x\n    ans += T\n    return ans\n\n\nprint(solve())\n", "passed": true, "time": 0.15, "memory": 14304.0, "status": "done"}, {"code": "n, t = map(int, input().split())\nl = list(map(int, input().split()))\ntotal=0\nfor i in range(n):\n    if i==n-1:# last element\n        total+=t\n        break\n    if l[i+1]-l[i]>=t:\n        total+=t\n    else:\n        total+=l[i+1]-l[i]\nprint(total)", "passed": true, "time": 0.14, "memory": 14108.0, "status": "done"}, {"code": "n,m = map(int, input().split())\nt = list(map(int, input().split()))\nnum = 0\nfor i in range(n-1):\n    if t[i+1]-t[i] < m:\n        num += t[i+1]-t[i]\n    else:\n        num += m\nprint(num+m)", "passed": true, "time": 0.14, "memory": 14296.0, "status": "done"}, {"code": "n, t = map(int, input().split())\narr = list(map(int, input().split()))\nsumm = t\nfor i in range(n-1):\n  summ += min(t, arr[i+1] - arr[i])\nprint(summ)", "passed": true, "time": 0.15, "memory": 14252.0, "status": "done"}, {"code": "N, T = map(int, input().split())\nt = list(map(int, input().split()))\n\nans = 0\nfor n in range(1, N):\n    timeD = t[n] - t[n-1]\n    if T >= timeD:\n        ans += timeD\n    else:\n        ans += T\nans += T\nprint(ans)", "passed": true, "time": 0.14, "memory": 14112.0, "status": "done"}, {"code": "n,T=list(map(int,input().split()))\nt=list(map(int,input().split()))\n\nans=0\nfor i in range(n-1):\n    ans+=min(t[i+1]-t[i],T)\nans+=T\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14364.0, "status": "done"}, {"code": "n,t = map(int,input().split())\ntlist = list(map(int,input().split()))\ntime = t\nfor i in range(0,n-1):\n    if tlist[i+1]- tlist[i] <= t :\n        time += tlist[i+1]- tlist[i]\n    else:\n        time += t\nprint(time)", "passed": true, "time": 0.14, "memory": 14072.0, "status": "done"}, {"code": "N,T = map(int,input().rstrip().split(\" \"))\nt = list(map(int,input().rstrip().split(\" \")))\nans = 0\nfor i in range(N-1):\n    ans += min(T,t[i+1] - t[i])\nans += T\nprint(ans)", "passed": true, "time": 0.14, "memory": 14108.0, "status": "done"}, {"code": "N, T = list(map(int,input().split()))\nA = list(map(int,input().split()))\n\nans = 0 \nfor i in range(len(A)-1):\n    ans += min(T,A[i+1]-A[i])\n\nprint(ans+T)", "passed": true, "time": 0.15, "memory": 14300.0, "status": "done"}, {"code": "n,T=map(int,input().split())\nt=list(map(int,input().split()))\nans=0\nfor i in range(n-1):\n  if t[i+1]-t[i]>=T:\n    ans+=T\n  else:\n    ans+=t[i+1]-t[i]\n\nans+=T\nprint(ans)", "passed": true, "time": 0.14, "memory": 14076.0, "status": "done"}, {"code": "N, T = map(int,input().split())\nt_lis = list(map(int,input().split()))\n\nans = 0\nfor i in range(1,N):\n  t = t_lis[i] - t_lis[i-1]\n  ans += min(t, T)\n  \nprint(ans + T)", "passed": true, "time": 0.23, "memory": 14272.0, "status": "done"}, {"code": "a,b=input().split()\na=int(a)\nb=int(b)\nc=list(map(int,input().split()))\nm=a*b\nfor i in range(a-1):\n  if c[i+1]-c[i]<b:\n    m=m-(b-(c[i+1]-c[i]))\nprint(m)", "passed": true, "time": 0.23, "memory": 14320.0, "status": "done"}, {"code": "n,t = map(int, input().split())\nl = list(map(int ,input().split()))\n\nnums = [0]*(n-1)\nfor i in range(n-1): nums[i] = l[i+1] - l[i]\n\nans = t\nm = 0\nfor i in nums:\n  ans += min(i,t)\nprint(ans)", "passed": true, "time": 0.21, "memory": 14160.0, "status": "done"}, {"code": "N,T=map(int,input().split())\nt=list(map(int,input().split()))\nt.append(10**10)\nans=0\nflg=0\ntemp=0\n\nfor i in range(N):\n  if t[i]+T > t[i+1]:\n    if flg==0:\n      temp=t[i]\n      flg=1\n    continue\n  else:\n    if flg==0:\n      ans+=T\n    else:\n      ans+=t[i]-temp+T\n    flg=0\nprint(ans)", "passed": true, "time": 0.27, "memory": 14272.0, "status": "done"}, {"code": "import sys\nimport math\nimport itertools\nimport bisect\nfrom copy import copy,deepcopy\nfrom collections import deque,Counter\nfrom decimal import Decimal\ndef s(): return input()\ndef i(): return int(input())\ndef S(): return input().split()\ndef I(): return map(int,input().split())\ndef L(): return list(map(int,input().split()))\ndef l(): return list(map(int,input().split()))\ndef lcm(a,b): return a*b//math.gcd(a,b)\nsys.setrecursionlimit(10 ** 9)\nINF = 10**9\nmod = 10**9+7\n\nN,T = I()\nt = l()\nans = T\nfor i in range(N-1):\n    ans += min(t[i+1]-t[i],T)\nprint(ans)", "passed": true, "time": 0.14, "memory": 14368.0, "status": "done"}, {"code": "N,S = map(int,input().split())\nT = list(map(int,input().split()))\na = S\n\nfor n in range(N-1):\n  a+=min(S,T[n+1]-T[n])\n\nprint(a)", "passed": true, "time": 0.26, "memory": 14168.0, "status": "done"}, {"code": "n,t = map(int,input().split())\ntm = list(map(int,input().split()))\nstart_time = -1\nstop_time = -1\nans = 0\nfor i in range(0,n):\n    if start_time <= tm[i] <= stop_time:\n        stop_time += (t + tm[i]) - stop_time\n    else:\n        ans += (stop_time - start_time)\n        start_time = tm[i]\n        stop_time = tm[i] + t\n    if i == n-1:\n        ans += (stop_time - start_time)\nprint(ans)", "passed": true, "time": 0.14, "memory": 14296.0, "status": "done"}, {"code": "import math\nfrom math import gcd,pi,sqrt\nINF = float(\"inf\")\n\nimport sys\nsys.setrecursionlimit(10**6)\nimport itertools\nfrom collections import Counter,deque\ndef i_input(): return int(input())\ndef i_map(): return list(map(int, input().split()))\ndef i_list(): return list(i_map())\ndef i_row(N): return [i_input() for _ in range(N)]\ndef i_row_list(N): return [i_list() for _ in range(N)]\ndef s_input(): return input()\ndef s_map(): return input().split()\ndef s_list(): return list(s_map())\ndef s_row(N): return [s_input for _ in range(N)]\ndef s_row_str(N): return [s_list() for _ in range(N)]\ndef s_row_list(N): return [list(s_input()) for _ in range(N)]\n\ndef main():\n    N,T = i_map()\n    t = i_list()\n\n    ans = 0\n    for i,k in enumerate(t[1:], start=1):\n        if k - t[i-1] <= T:\n            ans += k - t[i-1]\n        else:\n            ans += T\n    ans += T\n    print(ans)\n\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.27, "memory": 14208.0, "status": "done"}, {"code": "def test():\n    arr=[]\n    ans=0\n    first_input=input()\n    first_num=first_input.split()\n    a=int(first_num[0])\n    b=int(first_num[1])\n    sec_input=input()\n    sec_num=sec_input.split()\n    if len(sec_num)==a:\n        pass\n    else:\n        print('Wrong input')\n\n\n    for i in sec_num:\n        arr.append(int(i))\n\n    for i in range(0,len(arr)-1):\n        num=arr[i]\n        num_2=arr[i+1]\n        if num_2-num>b:\n          ans+=b\n        else:\n          ans+=num_2-num\n\n    ans+=b\n    print(ans)\n\n\ntest()", "passed": true, "time": 0.34, "memory": 14384.0, "status": "done"}, {"code": "n,t=list(map(int,input().split()))\nl=list(map(int,input().split()))\ns=0\nz=0\nfor i in l:\n    if z-i>0:\n        s+=i+t-z\n    else:\n        s+=t\n    z=i+t\nprint(s)\n", "passed": true, "time": 0.14, "memory": 14072.0, "status": "done"}, {"code": "N, T = list(map(int, input().split()))\nt = list(map(int, input().split()))\nans = 0\nfor i in range(N-1):\n    ans += min(T, t[i+1]-t[i])\nans += T\nprint(ans)\n", "passed": true, "time": 0.22, "memory": 14128.0, "status": "done"}, {"code": "#!/usr/bin/env python3\nN, T = list(map(int, input().split()))\nt = list(map(int, input().split()))\n\nans = 0\nfor i in range(N - 1):\n    if t[i + 1] - t[i] > T:\n        ans += T\n    else:\n        ans += t[i + 1] - t[i]\nans += T\nprint(ans)\n", "passed": true, "time": 0.25, "memory": 14344.0, "status": "done"}, {"code": "N,T = map(int,input().split())\nt = list(map(int,input().split()))\nans = 0\nfor i in range(1,N):\n    ans += min(T,t[i]-t[i-1])\nans += T\nprint(ans)", "passed": true, "time": 0.27, "memory": 14152.0, "status": "done"}, {"code": "N, T = map(int, input().split())\nt = list(map(int, input().split()))\n\nans, now = 0, 0\nfor i in t:\n    if i < now:\n        ans -= now - i\n    ans += T\n    now = i + T\nprint(ans)", "passed": true, "time": 0.26, "memory": 14112.0, "status": "done"}, {"code": "N, T = [int(i) for i in input().split(\" \")]\nt = [int(j) for j in input().split(\" \")]\n\ndt = []\nfor i in range(N - 1):\n  dt.append(t[i + 1] - t[i])\nelse:\n  dt.append(T)\n\nprint(sum([min([dti, T]) for dti in dt]))", "passed": true, "time": 0.14, "memory": 14104.0, "status": "done"}, {"code": "n,t=map(int,input().split())\nt_list=list(map(int,input().split()))\ns = 0\nfor i in range(1, n):\n  if t_list[i]-t_list[i-1] >= t:\n    s += t\n  else:\n    s += t_list[i]-t_list[i-1]\nprint(s+t)", "passed": true, "time": 0.18, "memory": 14204.0, "status": "done"}, {"code": "n, t = map(int, input().split())\na = list(map(int, input().split())) + [10**10]\n\nans = 0\nfor i in range(n):\n  ans += min(a[i+1] - a[i], t)\n\nprint(ans)", "passed": true, "time": 0.23, "memory": 14280.0, "status": "done"}, {"code": "N, T = [int(x) for x in input().split()]\nt = [int(x) for x in input().split()]\n\nT_start = 0\nT_end = T\nT_total = 0\n\nfor i in range(1, N):\n    if t[i] <= T_end:\n        T_end = t[i] + T\n    else: # t[i] > T_end\n        T_total += T_end - T_start\n        T_start = t[i]\n        T_end = t[i] + T\n\nT_total += T_end - T_start\n\nprint(T_total)", "passed": true, "time": 0.14, "memory": 14272.0, "status": "done"}, {"code": "n, T = map(int, input().split())\nt = list(map(int, input().split()))\n\nans = 0\nfor i in range(n-1):\n    ans += min(T, t[i+1]-t[i])\nans += T\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14340.0, "status": "done"}, {"code": "N, T = list(map(int,input().split()))\nt = list(map(int,input().split()))\n\ntime = T\nfor i in range(N-1):\n    if t[i+1]-t[i]>=T:\n        time += T\n    else:\n        time += t[i+1]-t[i]\nprint(time)\n", "passed": true, "time": 0.14, "memory": 14108.0, "status": "done"}, {"code": "N, T = map(int, input().split())\nt = list(map(int, input().split()))\nans = T\nfor i in range(N-1):\n  if t[i] + T <= t[i+1]:\n    ans += T\n  else:\n    ans += t[i+1] - t[i] \nprint(ans)", "passed": true, "time": 0.14, "memory": 14064.0, "status": "done"}, {"code": "n,t=list(map(int,input().split()))\nl=list(map(int,input().split()))\ns=0\nfor i in range(len(l)-1):\n  s+=min(t,l[i+1]-l[i])\ns+=t\nprint(s)\n", "passed": true, "time": 0.14, "memory": 14084.0, "status": "done"}, {"code": "'''\nCreated on 2020/08/16\n\n@author: harurun\n'''\nN,T=map(int,input().split())\nt=list(map(int,input().split()))\nans=T\ns=t[0]\nfor i in range(1,N):\n  if t[i]-s>=T:\n    ans+=T \n  else:\n    ans-=T-(t[i]-s)\n    ans+=T\n  s=t[i]\nprint(ans)  ", "passed": true, "time": 0.14, "memory": 14104.0, "status": "done"}, {"code": "N,T = map(int,input().split())\nN_List = list(map(int,input().split()))\n\nans = 0\nfor i in range(1,N):\n    ans += (T,N_List[i]-N_List[i-1])[N_List[i]-N_List[i-1]<=T]\n\nans += T\nprint(ans)", "passed": true, "time": 0.14, "memory": 14188.0, "status": "done"}, {"code": "n,t = map(int,input().split())\ntl = list(map(int,input().split()))\nans = t\nfor i in range(n-1):\n\tif tl[i+1]-tl[i] >= t:\n\t\tans += t\n\telse:\n\t\tans += t-(t-(tl[i+1]-tl[i]))\nprint(ans)", "passed": true, "time": 0.13, "memory": 14256.0, "status": "done"}, {"code": "n, m = list(map(int, input().split()))\nt = list(map(int, input().split()))\n\nans = 0\n\nfor i in range(n):\n    if i == n-1:\n        ans += m\n    elif t[i+1] - t[i] > m:\n        ans += m\n    else:\n        ans += t[i+1] - t[i]\n\nprint(ans)\n\n\n", "passed": true, "time": 0.15, "memory": 14056.0, "status": "done"}, {"code": "N, T = map(int, input().split())\nt = list(map(int, input().split()))\nSum = T\n\nfor i in range(1, N):\n    if t[i] - t[i - 1] < T:\n        Sum += t[i] - t[i - 1]\n    else:\n        Sum += T\n\nprint(Sum)", "passed": true, "time": 0.14, "memory": 14088.0, "status": "done"}, {"code": "n, t = map(int, input().split())\nt_lst = list(map(int, input().split()))\naccumulate = 0\n\nfor i in range(n - 1):\n    time = t_lst[i + 1] - t_lst[i]\n    accumulate += min(time, t)\n\naccumulate += t\nprint(accumulate)", "passed": true, "time": 0.14, "memory": 14368.0, "status": "done"}, {"code": "N, T = map(int, input().split())\nt = list(map(int, input().split()))\n\nans = T\nfor i in range(1, N):\n    diff = t[i] - t[i-1]\n    ans += min(diff, T)\nprint(ans)", "passed": true, "time": 0.14, "memory": 14340.0, "status": "done"}, {"code": "N,T = map(int,input().split())\nt = list(map(int,input().split()))\nX = T\n\nfor n in range(1,N):\n  d = t[n]-t[n-1]\n  if d<=T:\n    X+=d\n  else:\n    X+=T\n    \nprint(X)", "passed": true, "time": 0.23, "memory": 14060.0, "status": "done"}, {"code": "n,t = map(int, input().split())\nl = list(map(int, input().split()))\n\nans = t\nfor i in range(n-1):\n  ans += min(t,l[i+1]-l[i])\nprint(ans)", "passed": true, "time": 0.14, "memory": 14092.0, "status": "done"}, {"code": "N,T=map(int,input().split())\nList = list(map(int, input().split()))\nres = 0\nfor i in range(1,N):\n  sumsum = List[i]-List[i-1]\n  if sumsum >= T:\n    res += T\n  else:\n    res += sumsum\nres += T\nprint(res)", "passed": true, "time": 0.23, "memory": 14212.0, "status": "done"}, {"code": "N, T = list(map(int, input().split()))\nt = list(map(int, input().split()))\nans = 0\n\nfor i in range(N-1):\n  tmp = t[i+1] - t[i]\n  ans += min(tmp, T)\n\nprint(ans+T)", "passed": true, "time": 0.14, "memory": 14212.0, "status": "done"}, {"code": "N,T=list(map(int,input().split()))\nt=list(map(int,input().split()))\n\nans=0\nfor i in range(0,N-1):\n    if t[i]+T>t[i+1]:\n        ans+=t[i+1]-t[i]\n    else:\n        ans+=T\nans+=T\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14340.0, "status": "done"}, {"code": "N, T = map(int,input().split())\ntime = list(map(int, input().split())) + [float('inf')]\n\nnow = 0\nprev = 0\nans = 0\nfor t in time:\n    if t - prev >= T:\n        ans += T\n    else:\n        ans += t - prev\n    prev = t\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14168.0, "status": "done"}, {"code": "N, T = list(map(int, input().split()))\nt = list(map(int, input().split()))\nt.append(float('inf'))\nans = 0\nfor i in range(len(t)-1):  \n  ans += min(T, t[i+1] - t[i])\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14160.0, "status": "done"}, {"code": "numbers = list([int(x) for x in input().split()])\nnums = list([int(x) for x in input().split()])\nt = numbers[1]\n\ntotal = t\nfor i in range(1, len(nums)):\n    check = nums[i] - nums[i - 1] \n    total += check if check <= t else t\n\nprint(total)\n    \n", "passed": true, "time": 0.14, "memory": 14116.0, "status": "done"}, {"code": "N, T = list(map(int, input().split()))\ntt = list(map(int, input().split()))\nans = 0\n\nfor i in range(N - 1):\n  nn = tt[i + 1] - tt[i]\n  if nn > T:\n    ans += T\n  else:\n    ans += nn\n    \nans += T\nprint(ans)\n    \n", "passed": true, "time": 0.15, "memory": 14316.0, "status": "done"}, {"code": "from sys import stdin\n\ndef main():\n    N,T=list(map(int,stdin.readline().strip().split()))\n    t=list(map(int,stdin.readline().strip().split()))\n\n    x=0\n    for i in range(N-1):\n        x+=min(T,t[i+1]-t[i])\n    print((x+T))\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14172.0, "status": "done"}, {"code": "n,t=map(int,input().split())\na=list(map(int,input().split()))\nans=0\nfor i in range(n):\n  if i==0:\n    ans+=t\n  elif a[i-1]+t<=a[i]:\n    ans+=t\n  else:\n    ans+=a[i]-a[i-1]\nprint(ans)", "passed": true, "time": 0.14, "memory": 14112.0, "status": "done"}, {"code": "N, T = map(int, input().split())\nt = list(map(int, input().split()))\nans = 0\nfor i in range(N-1):\n  if t[i]+T <= t[i+1]:\n    ans += T\n  else:\n    ans += t[i+1]-t[i]\nans += T\nprint(ans)", "passed": true, "time": 0.14, "memory": 14108.0, "status": "done"}, {"code": "N,T=map(int,input().split())\nt=list(map(int,input().split()))\nans=0\nm=0\nfor i in range(1,N):\n    if T<t[i]-t[i-1]:\n        ans+=T\n    else:\n        ans+=t[i]-t[i-1]\nprint(ans+T)", "passed": true, "time": 0.14, "memory": 14352.0, "status": "done"}, {"code": "n, k = map(int,input().split())\nt = list(map(int,input().split()))\n\nans = n*k\nfor i in range(1, n):\n    diff = k - min(t[i] - t[i-1], k)\n    ans -= diff\nprint(ans)", "passed": true, "time": 0.14, "memory": 14112.0, "status": "done"}, {"code": "n,T = list(map(int, input().split()))\n\nt = list(map(int, input().split()))\nans = 0\nfor i, j in zip(t,t[1:]):\n  ans += min(j-i,T)\nprint((ans + T))\n", "passed": true, "time": 0.14, "memory": 14028.0, "status": "done"}, {"code": "N,T = list(map(int, input().split()))\nt = list(map(int,input().split()))\nans = 0\nfor i in range(N):\n    if i == 0:\n        continue\n\n    if t[i] - t[i-1] < T:\n        ans += t[i] - t[i-1]\n    else:\n        ans += T\n\nans += T\nprint (ans)\n", "passed": true, "time": 0.14, "memory": 14296.0, "status": "done"}]