#include <bits/stdc++.h>
using namespace std;
int min_x(int a, int b) {
  if (a < b)
    return a;
  else
    return b;
}
unsigned int edit_distance(const std::string& s1, const std::string& s2) {
  const std::size_t len1 = s1.size(), len2 = s2.size();
  std::vector<std::vector<unsigned int>> d(len1 + 1,
                                           std::vector<unsigned int>(len2 + 1));
  d[0][0] = 0;
  for (unsigned int i = 1; i <= len1; ++i) d[i][0] = i;
  for (unsigned int i = 1; i <= len2; ++i) d[0][i] = i;
  for (unsigned int i = 1; i <= len1; ++i)
    for (unsigned int j = 1; j <= len2; ++j)
      d[i][j] = std::min(std::min(d[i - 1][j] + 1, d[i][j - 1] + 1),
                         d[i - 1][j - 1] + (s1[i - 1] == s2[j - 1] ? 0 : 1));
  return d[len1][len2];
}
bool Win(int sum, int count, int player, int* a) {
  if (sum == 31)
    if (count % 2 == player)
      return true;
    else
      return false;
  if (sum > 31)
    if (count % 2 == player)
      return false;
    else
      return true;
  if (sum < 31) {
    for (long long i = 1; i < 7; i++) {
      if (a[i - 1]) {
        a[i - 1]--;
        if (count % 2 == player) {
          if (Win(sum + i, count + 1, player, a)) {
            a[i - 1]++;
            return true;
          }
          a[i - 1]++;
        } else {
          if (Win(sum + i, count + 1, player, a)) {
            a[i - 1]++;
            return false;
          }
          a[i - 1]++;
        }
      }
    }
    if (count % 2 == player)
      return false;
    else
      return true;
  }
}
bool check_p(string s) {
  for (long long i = 0; i < (s.size() + 1) / 2; i++) {
    if (s[i] != s[s.size() - 1 - i]) {
      return false;
    }
  }
  return true;
}
int main() {
  string s;
  cin >> s;
  int k;
  cin >> k;
  bool b = true;
  if ((s.size() % k) == 0) {
    int border = s.size() / k;
    for (long long i = 0; i < k; i++) {
      if (!check_p(s.substr(i * border, border))) {
        cout << "NO" << endl;
        return 0;
      }
    }
    cout << "YES" << endl;
  } else
    cout << "NO" << endl;
}

### Prompt

Your task is to create a Cpp solution to the following problem:

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.

<image>

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.

Input

The first line of input contains string s containing lowercase English letters (1 ≤ |s| ≤ 1000).

The second line contains integer k (1 ≤ k ≤ 1000).

Output

Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise.

Examples

Input

saba
2


Output

NO


Input

saddastavvat
2


Output

YES

Note

Palindrome is a string reading the same forward and backward.

In the second sample, the faxes in his back-bag can be "saddas" and "tavvat".

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int min_x(int a, int b) {
  if (a < b)
    return a;
  else
    return b;
}
unsigned int edit_distance(const std::string& s1, const std::string& s2) {
  const std::size_t len1 = s1.size(), len2 = s2.size();
  std::vector<std::vector<unsigned int>> d(len1 + 1,
                                           std::vector<unsigned int>(len2 + 1));
  d[0][0] = 0;
  for (unsigned int i = 1; i <= len1; ++i) d[i][0] = i;
  for (unsigned int i = 1; i <= len2; ++i) d[0][i] = i;
  for (unsigned int i = 1; i <= len1; ++i)
    for (unsigned int j = 1; j <= len2; ++j)
      d[i][j] = std::min(std::min(d[i - 1][j] + 1, d[i][j - 1] + 1),
                         d[i - 1][j - 1] + (s1[i - 1] == s2[j - 1] ? 0 : 1));
  return d[len1][len2];
}
bool Win(int sum, int count, int player, int* a) {
  if (sum == 31)
    if (count % 2 == player)
      return true;
    else
      return false;
  if (sum > 31)
    if (count % 2 == player)
      return false;
    else
      return true;
  if (sum < 31) {
    for (long long i = 1; i < 7; i++) {
      if (a[i - 1]) {
        a[i - 1]--;
        if (count % 2 == player) {
          if (Win(sum + i, count + 1, player, a)) {
            a[i - 1]++;
            return true;
          }
          a[i - 1]++;
        } else {
          if (Win(sum + i, count + 1, player, a)) {
            a[i - 1]++;
            return false;
          }
          a[i - 1]++;
        }
      }
    }
    if (count % 2 == player)
      return false;
    else
      return true;
  }
}
bool check_p(string s) {
  for (long long i = 0; i < (s.size() + 1) / 2; i++) {
    if (s[i] != s[s.size() - 1 - i]) {
      return false;
    }
  }
  return true;
}
int main() {
  string s;
  cin >> s;
  int k;
  cin >> k;
  bool b = true;
  if ((s.size() % k) == 0) {
    int border = s.size() / k;
    for (long long i = 0; i < k; i++) {
      if (!check_p(s.substr(i * border, border))) {
        cout << "NO" << endl;
        return 0;
      }
    }
    cout << "YES" << endl;
  } else
    cout << "NO" << endl;
}

```