Problem :

https://www.hackerrank.com/challenges/lisa-workbook/problem


My Solution :

#!/usr/bin/env python3


def workbook(n, k, arr):
    special = 0
    page = 1
    for problems in arr:
        for number in range(1, problems + 1):
            if page == number:
                special += 1
            if number % k == 0:
                page += 1
        if number % k != 0:
            page += 1
    return special


n, k = map(int, input().split())
arr = list(map(int, input().rstrip().split()))
result = workbook(n, k, arr)
print(result)