While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string *s*.

He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly *k* messages in his own bag, each was a palindrome string and all those strings had the same length.

He asked you to help him and tell him if he has worn his own back-bag. Check if the given string *s* is a concatenation of *k* palindromes of the same length.
The first line of input contains string *s* containing lowercase English letters (1 ≤ |*s*| ≤ 1000).

The second line contains integer *k* (1 ≤ *k* ≤ 1000).
# -*- coding: utf-8 -*-
"""
Spyder Editor

This is a temporary script file.
"""

def palindrome(s):
    reverse = ''
    rev_ind = -1
    
    for i in range(len(s)):
        reverse += s[rev_ind]
        rev_ind -= 1
        
    return s == reverse

s = input()
l = len(s)

k = int(input())

if k == 0:
   if palindrome(s):
       print('YES')
   else:
       print('NO')
   
else:
    
    if l % k == 0:    
        index_increment = l//k
        pal_flag = 1;
        
        substr_ind = 0
        last_index = l - index_increment
        
        substr_list = []
        
        while substr_ind <= last_index:
            substr_list.append(s[substr_ind:substr_ind + index_increment])
            substr_ind += index_increment
            
        for substr in substr_list:
            if palindrome(substr) == False:
                pal_flag = 0
        
        if pal_flag :
            print('YES')
        else:
            print('NO')
                
    else:
        print('NO')
        