#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 7;
int read() {
  char ch = getchar();
  int f = 1, x = 0;
  while (ch < '0' or ch > '9') {
    if (ch == '-') {
      f = -1;
      ch = getchar();
    }
  }
  while (ch >= '0' and ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int l = 0, r = -1;
long long hsh;
long long hsh_num[400005];
string s;
long long tmp, tmp2;
void inithsh() {
  hsh_num[0] = 1ull;
  for (int i = 1; i <= 400000; i++) {
    hsh_num[i] = hsh_num[i - 1] * INF;
  }
  tmp = 1ull;
  unsigned long long cur = hsh_num[1];
  for (int i = 0; i < 63; i++) {
    tmp *= cur;
    cur *= cur;
  }
}
bool ispal(int cl, int cr) {
  if (cl < 0) {
    return false;
  }
  while (l < cl) {
    hsh = (hsh - s[l]) * tmp;
    tmp2 -= hsh_num[r - l] * s[l];
    l++;
  }
  while (l > cl) {
    l--;
    hsh = hsh * hsh_num[1] + s[l];
    tmp2 += hsh_num[r - l] * s[l];
  }
  while (r < cr) {
    r++;
    hsh += hsh_num[r - l] * s[r];
    tmp2 = tmp2 * hsh_num[1] + s[r];
  }
  while (r > cr) {
    hsh -= hsh_num[r - l] * s[r];
    tmp2 = (tmp2 - s[r]) * tmp;
    r--;
  }
  return hsh == tmp2;
}
void modify(int id, char res) {
  if (id >= l and id <= r) {
    hsh += hsh_num[id - l] * (res - s[id]);
    tmp2 += hsh_num[r - id] * (res - s[id]);
  }
  s[id] = res;
}
bool able(int i, int d) {
  char rc = s[i];
  modify(i, s[i] + 1);
  while (s[i] < 'a' + 26 and (ispal(i - d + 1, i) or ispal(i - d, i))) {
    modify(i, s[i] + 1);
  }
  if (s[i] == 'a' + 26) {
    modify(i, rc);
    return false;
  }
  i++;
  while (i < s.length()) {
    modify(i, 'a');
    while (ispal(i - d + 1, i) or ispal(i - d, i)) {
      modify(i, s[i] + 1);
    }
    i++;
  }
  return true;
}
int main() {
  inithsh();
  int n, d, L;
  d = read();
  cin >> s;
  n = s.length();
  L = 0;
  while (L < n and (!ispal(L - d + 1, L) and !ispal(L - d, L))) {
    L++;
  }
  for (int i = min(L, n - 1); i >= 0; i--) {
    if (able(i, d)) {
      cout << s << endl;
      return 0;
    }
  }
  cout << "Impossible" << endl;
  return 0;
}
