#include <bits/stdc++.h>
using namespace std;
const int MAX = 4e5 + 9, MOD = 1e9 + 7, B = 1999;
int f1[MAX], f2[MAX], d, k, pw[MAX], n;
string s, t;
void upd(int x, int v, int f[]) {
  for (; x < MAX; x += x & -x) f[x] = (f[x] + v) % MOD;
}
int get(int x, int f[]) {
  int ret = 0;
  for (; x; x -= x & -x) ret = (ret + f[x]) % MOD;
  return ret;
}
int get1(int l, int r) {
  return 1LL * (get(r, f1) - get(l - 1, f1) + MOD) % MOD * pw[n - l] % MOD;
}
int get2(int l, int r) {
  return 1LL * (get(r, f2) - get(l - 1, f2) + MOD) % MOD * pw[r - 1] % MOD;
}
bool ok(int i) {
  if (i >= d && get1(i - d + 1, i) == get2(i - d + 1, i)) return true;
  if (i >= d + 1 && get1(i - d, i) == get2(i - d, i)) return true;
  return false;
}
void change(int x, char ch) {
  upd(x, (MOD - 1LL * pw[x] * t[x] % MOD) % MOD, f1);
  upd(x, 1LL * pw[x] * ch % MOD, f1);
  upd(x, (MOD - 1LL * pw[n - x + 1] * t[x] % MOD) % MOD, f2);
  upd(x, 1LL * pw[n - x + 1] * ch % MOD, f2);
  t[x] = ch;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  pw[0] = 1;
  for (int i = 1; i < MAX; i++) pw[i] = 1LL * pw[i - 1] * B % MOD;
  cin >> d >> s, s = '.' + s, n = s.size() - 1, t = s;
  for (int i = 1; i <= n; i++)
    upd(i, 1LL * pw[i] * s[i] % MOD, f1),
        upd(i, 1LL * pw[n - i + 1] * s[i] % MOD, f2);
  int p = 1;
  for (; p <= n; p++)
    if (ok(p)) break;
  p = min(p, n);
  for (; p >= 1; p--) {
    char ch;
    for (ch = s[p] + 1; ch <= 'z'; ch++) {
      change(p, ch);
      if (!ok(p)) break;
    }
    if (ch > 'z')
      change(p, s[p]);
    else
      break;
  }
  if (!p) return cout << "Impossible", 0;
  p++;
  for (; p <= n; p++)
    for (char ch = 'a'; ch <= 'z'; ch++) {
      change(p, ch);
      if (!ok(p)) break;
    }
  cout << t.substr(1);
}
