#include <bits/stdc++.h>
using namespace std;
char s[400005];
int n, d;
long long p[400005], inv[400005];
long long t1[400005], t2[400005];
inline long long qpow(long long a, long long b) {
  long long res = 1, tp = a;
  while (b) {
    if (b & 1ll) {
      res *= tp;
      res %= 1000000009ll;
    }
    tp *= tp;
    tp %= 1000000009ll;
    b >>= 1ll;
  }
  return res;
}
inline void add1(int p, long long a) {
  while (p <= n) {
    t1[p] += a;
    if (t1[p] >= 1000000009ll) t1[p] -= 1000000009ll;
    p += (p & (-p));
  }
}
inline void add2(int p, long long a) {
  while (p <= n) {
    t2[p] += a;
    if (t2[p] >= 1000000009ll) t2[p] -= 1000000009ll;
    p += (p & (-p));
  }
}
inline long long ask1(int p) {
  long long s = 0;
  while (p) {
    s += t1[p];
    if (s >= 1000000009ll) s -= 1000000009ll;
    p -= (p & (-p));
  }
  return s;
}
inline long long ask2(int p) {
  long long s = 0;
  while (p) {
    s += t2[p];
    if (s >= 1000000009ll) s -= 1000000009ll;
    p -= (p & (-p));
  }
  return s;
}
inline bool chk(int st, int ed) {
  long long val1 = ask1(ed) - ask1(st - 1);
  if (val1 < 0) val1 += 1000000009ll;
  val1 *= inv[n - ed];
  val1 %= 1000000009ll;
  long long val2 = ask2(ed) - ask2(st - 1);
  if (val2 < 0) val2 += 1000000009ll;
  val2 *= inv[st - 1];
  val2 %= 1000000009ll;
  return (val1 == val2);
}
inline bool ok(int pos) {
  s[pos]++;
  while (s[pos] <= 'z') {
    add1(pos, p[n - pos]);
    add2(pos, p[pos - 1]);
    if (pos >= d && chk(pos - d + 1, pos)) {
      s[pos]++;
      continue;
    }
    if (pos >= d + 1 && chk(pos - d, pos)) {
      s[pos]++;
      continue;
    }
    return true;
  }
  return false;
}
int main() {
  scanf("%d", &d);
  scanf("%s", s + 1);
  n = strlen(s + 1);
  int i, j, pos = n;
  p[0] = 1ll;
  for (i = 1; i <= n; i++) {
    p[i] = p[i - 1] * 37ll;
    p[i] %= 1000000009ll;
  }
  inv[n] = qpow(p[n], 1000000009ll - 2ll);
  for (i = n - 1; i >= 0; i--) {
    inv[i] = inv[i + 1] * 37ll;
    inv[i] %= 1000000009ll;
  }
  for (i = 1; i <= n; i++) {
    add1(i, (p[n - i] * ((long long)(s[i] - 'a' + 1))) % 1000000009ll);
    add2(i, (p[i - 1] * ((long long)(s[i] - 'a' + 1))) % 1000000009ll);
    if (i >= d && chk(i - d + 1, i)) {
      pos = i;
      break;
    }
    if (i >= d + 1 && chk(i - d, i)) {
      pos = i;
      break;
    }
  }
  while (pos >= 1 && (!ok(pos))) pos--;
  if (pos == 0) {
    puts("Impossible");
    return 0;
  }
  memset(t1, 0, sizeof(t1));
  memset(t2, 0, sizeof(t2));
  for (i = 1; i <= pos; i++) {
    add1(i, (p[n - i] * ((long long)(s[i] - 'a' + 1))) % 1000000009ll);
    add2(i, (p[i - 1] * ((long long)(s[i] - 'a' + 1))) % 1000000009ll);
  }
  for (i = pos + 1; i <= n; i++) {
    s[i] = 'a';
    while (s[i] <= 'z') {
      add1(i, p[n - i]);
      add2(i, p[i - 1]);
      if (i >= d && chk(i - d + 1, i)) {
        s[i]++;
        continue;
      }
      if (i >= d + 1 && chk(i - d, i)) {
        s[i]++;
        continue;
      }
      break;
    }
    if (s[i] > 'z') {
      puts("Impossible");
      return 0;
    }
  }
  for (i = 1; i <= n; i++) {
    putchar(s[i]);
  }
  return 0;
}
