from sys import exit
__author__ = 'Zlobober'
s = raw_input()
k = int(raw_input())
n = len(s)
if len(s) % k != 0:
print "NO"
else:
for i in range(k):
if s[i * (n // k) : (i + 1) * (n // k)] != ''.join(reversed(s[i * (n // k) : (i + 1) * (n // k)])):
print "NO"
exit(0)
print "YES"
ZnJvbSBzeXMgaW1wb3J0IGV4aXQKCl9fYXV0aG9yX18gPSAnWmxvYm9iZXInCnMgPSByYXdfaW5wdXQoKQprID0gaW50KHJhd19pbnB1dCgpKQpuID0gbGVuKHMpCmlmIGxlbihzKSAlIGsgIT0gMDoKICAgIHByaW50ICJOTyIKZWxzZToKICAgIGZvciBpIGluIHJhbmdlKGspOgogICAgICAgIGlmIHNbaSAqIChuIC8vIGspIDogKGkgKyAxKSAqIChuIC8vIGspXSAhPSAnJy5qb2luKHJldmVyc2VkKHNbaSAqIChuIC8vIGspIDogKGkgKyAxKSAqIChuIC8vIGspXSkpOgogICAgICAgICAgICBwcmludCAiTk8iCiAgICAgICAgICAgIGV4aXQoMCkKICAgIHByaW50ICJZRVMiCg==