#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using str = string;
const int mod = 1e9 + 7;
const int tbi = 1e5 + 5;
int chat2p(int a[], int x, int low, int high) {
  if (high >= low) {
    int mid = low + (high - low) / 2;
    if (x <= a[mid] and x > a[mid - 1]) return mid;
    if (a[mid] > x) return chat2p(a, x, low, mid - 1);
    return chat2p(a, x, mid + 1, high);
  }
  return -1;
}
bool ngto(ll n) {
  if (n < 2) return false;
  for (int i = 2; i <= sqrt(n); i++)
    if (n % i == 0) return false;
  return true;
}
bool xaudx(str s, int d, int c) {
  int x = (c - d + 1), tg = (d + c) / 2, i, j;
  if (x % 2 == 0) {
    i = tg;
    j = tg + 1;
  } else {
    i = tg;
    j = tg;
  }
  while (i >= d and j <= c) {
    if (s[i] != s[j])
      return false;
    else {
      i--;
      j++;
    }
  }
  return true;
}
ll gt(ll x) {
  ll g = 1;
  for (ll i = 1; i <= x; i++) g *= i;
  return g;
}
ll ucln(ll a, ll b) {
  ll tg;
  while (b > 0) {
    tg = a % b;
    a = b;
    b = tg;
  }
  return a;
}
int a[1000000 + 3];
int main() {
  int n, k;
  str s;
  cin >> s;
  cin >> k;
  n = s.size();
  if (n % k != 0)
    cout << "NO";
  else {
    int tg = n / k, i = 0, kt = 0;
    while (i <= n - tg) {
      if (xaudx(s, i, i + tg - 1) == 0) kt = 1;
      i += tg;
    }
    if (kt == 0)
      cout << "YES";
    else
      cout << "NO";
  }
}

### Prompt

Develop a solution in CPP to the problem described below:

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;
using ll = long long;
using str = string;
const int mod = 1e9 + 7;
const int tbi = 1e5 + 5;
int chat2p(int a[], int x, int low, int high) {
  if (high >= low) {
    int mid = low + (high - low) / 2;
    if (x <= a[mid] and x > a[mid - 1]) return mid;
    if (a[mid] > x) return chat2p(a, x, low, mid - 1);
    return chat2p(a, x, mid + 1, high);
  }
  return -1;
}
bool ngto(ll n) {
  if (n < 2) return false;
  for (int i = 2; i <= sqrt(n); i++)
    if (n % i == 0) return false;
  return true;
}
bool xaudx(str s, int d, int c) {
  int x = (c - d + 1), tg = (d + c) / 2, i, j;
  if (x % 2 == 0) {
    i = tg;
    j = tg + 1;
  } else {
    i = tg;
    j = tg;
  }
  while (i >= d and j <= c) {
    if (s[i] != s[j])
      return false;
    else {
      i--;
      j++;
    }
  }
  return true;
}
ll gt(ll x) {
  ll g = 1;
  for (ll i = 1; i <= x; i++) g *= i;
  return g;
}
ll ucln(ll a, ll b) {
  ll tg;
  while (b > 0) {
    tg = a % b;
    a = b;
    b = tg;
  }
  return a;
}
int a[1000000 + 3];
int main() {
  int n, k;
  str s;
  cin >> s;
  cin >> k;
  n = s.size();
  if (n % k != 0)
    cout << "NO";
  else {
    int tg = n / k, i = 0, kt = 0;
    while (i <= n - tg) {
      if (xaudx(s, i, i + tg - 1) == 0) kt = 1;
      i += tg;
    }
    if (kt == 0)
      cout << "YES";
    else
      cout << "NO";
  }
}

```