Buggy python submission (verdict: Time Limit Exceeded):
N,K = [int(x) for x in input().split()]
count = [0]*(K+1)
ans = 0
mod = 1000000007
for i in range(K,0,-1):
    kosuu = ((K//i)**N) %mod
    if K // i >= 2:
        for j in range(K//i,1,-1):
            kosuu -= count[j*i]
    ans += (i*kosuu)
    count[i] = kosuu
print(ans%1000000007)

Fixed submission:
N,K = [int(x) for x in input().split()]
count = [0]*(K+1)
ans = 0
mod = 1000000007
for i in range(K,0,-1):
    kosuu = pow(K//i,N,mod)
    if K // i >= 2:
        for j in range(K//i,1,-1):
            kosuu -= count[j*i]
    ans += i*kosuu
    count[i] = kosuu
print(ans%mod)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = [int(x) for x in input().split()]
count = [0]*(K+1)
ans = 0
for i in range(K,0,-1):
    kosuu = (K//i)**N
    if K // i >= 2:
        for j in range(K//i,1,-1):
            kosuu -= count[j*i]
    ans += (i*kosuu)%1000000007
    count[i] = kosuu
print(ans%1000000007)

Fixed submission:
N,K = [int(x) for x in input().split()]
count = [0]*(K+1)
ans = 0
mod = 1000000007
for i in range(K,0,-1):
    kosuu = pow(K//i,N,mod)
    if K // i >= 2:
        for j in range(K//i,1,-1):
            kosuu -= count[j*i]
    ans += i*kosuu
    count[i] = kosuu
print(ans%mod)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = [int(x) for x in input().split()]
count = [0]*(K+1)
ans = 0
for i in range(K,0,-1):
    kosuu = (K//i)**N
    if K // i >= 2:
        for j in range(K//i,1,-1):
            kosuu -= count[j*i]
    ans += (i*kosuu)%1000000007
    count[i] = kosuu
print(ans%1000000007)

Fixed submission:
N,K = [int(x) for x in input().split()]
count = [0]*(K+1)
ans = 0
mod = 1000000007
for i in range(K,0,-1):
    kosuu = pow(K//i,N,mod)
    if K // i >= 2:
        for j in range(K//i,1,-1):
            kosuu -= count[j*i]
    ans += i*kosuu
    count[i] = kosuu
print(ans%mod)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = [int(x) for x in input().split()]
count = [0]*(K+1)
for i in range(K,0,-1):
    count[i] = (K//i)**N
ans = 0
for i in range(K,0,-1):
    kosuu = count[i]
    if K // i >= 2:
        for j in range(K//i,1,-1):
            kosuu -= count[j*i]
    ans += (i*kosuu)%1000000007
    count[i] = kosuu
print(ans%1000000007)

Fixed submission:
N,K = [int(x) for x in input().split()]
count = [0]*(K+1)
ans = 0
mod = 1000000007
for i in range(K,0,-1):
    kosuu = pow(K//i,N,mod)
    if K // i >= 2:
        for j in range(K//i,1,-1):
            kosuu -= count[j*i]
    ans += i*kosuu
    count[i] = kosuu
print(ans%mod)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = [int(x) for x in input().split()]
count = [0]*(K+1)
for i in range(K,0,-1):
    count[i] = (K//i)**N
ans = 0
for i in range(K,0,-1):
    kosuu = count[i]
    if K // i >= 2:
        for j in range(K//i,1,-1):
            kosuu -= count[j*i]
    ans += (i*kosuu)%1000000007
    count[i] = kosuu
print(ans%1000000007)

Fixed submission:
N,K = [int(x) for x in input().split()]
count = [0]*(K+1)
ans = 0
mod = 1000000007
for i in range(K,0,-1):
    kosuu = pow(K//i,N,mod)
    if K // i >= 2:
        for j in range(K//i,1,-1):
            kosuu -= count[j*i]
    ans += i*kosuu
    count[i] = kosuu
print(ans%mod)