#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 10;
const int MN = 4e5 + 10, MOD = 1e9 + 7;
pair<int, int> seg[2][MN << 1];
string s;
int pw[MN];
int n, d;
void build() {
  for (int i = n - 1; ~i; --i) {
    seg[0][i].second = seg[0][i << 1].second + seg[0][i << 1 | 1].second;
    seg[1][i].second = seg[1][i << 1].second + seg[1][i << 1 | 1].second;
    seg[0][i].first =
        (1ll * seg[0][i << 1].first * pw[seg[0][i << 1 | 1].second] +
         seg[0][i << 1 | 1].first) %
        MOD;
    seg[1][i].first =
        (1ll * seg[1][i << 1 | 1].first * pw[seg[0][i << 1].second] +
         seg[1][i << 1].first) %
        MOD;
  }
}
void upd(int p, int val) {
  for (seg[0][p + n].first = val, seg[1][p += n].first = val; p > 1; p >>= 1) {
    int id = p >> 1;
    seg[0][id].first =
        (1ll * seg[0][id << 1].first * pw[seg[0][id << 1 | 1].second] +
         seg[0][id << 1 | 1].first) %
        MOD;
    seg[1][id].first =
        (1ll * seg[1][id << 1 | 1].first * pw[seg[1][id << 1].second] +
         seg[1][id << 1].first) %
        MOD;
  }
}
int L[100], R[100];
int sz_l, sz_r;
int get(int l, int r, int id) {
  int ret = 0;
  sz_l = 0, sz_r = 0;
  for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
    if (l & 1) L[sz_l++] = l++;
    if (r & 1) R[sz_r++] = --r;
  }
  if (id) {
    for (int i = sz_r - 1; ~i; --i) L[sz_l++] = R[i];
  } else {
    reverse(L, L + sz_l + sz_r);
    for (int i = 0; i < sz_r; ++i) L[i] = R[i];
    sz_l += sz_r;
  }
  int cur = 0;
  for (int i = 0; i < sz_l; ++i)
    ret = (1ll * seg[id][L[i]].first * pw[cur] + ret) % MOD,
    cur += seg[id][L[i]].second;
  return ret;
}
bool check(int t) {
  t++;
  if (t < d) return true;
  int v1 = get(t - d, t, 0), v2 = get(t - d, t, 1);
  if (v1 == v2) return false;
  if (t != d) {
    v1 = get(t - d - 1, t, 0), v2 = get(t - d - 1, t, 1);
    if (v1 == v2) return false;
  }
  return true;
}
void fail() {
  cout << "Impossible\n";
  exit(0);
}
int main() {
  ios_base ::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  pw[0] = 1;
  for (int i = 1; i < MN; ++i) pw[i] = 727ll * pw[i - 1] % MOD;
  cin >> d;
  cin >> s;
  n = ((int)(s).size());
  for (int i = 0; i < n; ++i)
    seg[0][i + n].first = seg[1][i + n].first = s[i] - 'a',
               seg[0][i + n].second = seg[1][i + n].second = 1;
  build();
  int ind = n - 1;
  for (int i = d - 1; i < n; ++i)
    if (!check(i)) {
      ind = i;
      break;
    }
  do {
    while (ind && s[ind] == 'z') --ind;
    if (s[ind] == 'z') fail();
    upd(ind, s[ind] - 'a' + 1), s[ind]++;
  } while (!check(ind));
  for (int i = ind + 1; i < n; ++i) upd(i, 0), s[i] = 'a';
  for (int i = ind + 1; i < n; ++i) {
    if (!check(i)) upd(i, s[i] - 'a' + 1), ++s[i], --i;
  }
  cout << s << endl;
  return 0;
}
