302 4
abdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcb
 300 3
abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc
 10 10
fajegfaicb
 70 4
dcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbd
 100 4
abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabca
 5 5
aceba
 3 4
cdb
 2 2
ab
 11 3
abcabcabcab
 3 26
yzx
 2 4
cd
 7 26
zyxzyxz
 3 3
acb
 1 2
a
 77 7
cadgbagbcaecgfaegcdbeafbacbdfgaedgcdeabgebaecbeacgfebagedcegdafdgeacegfegfegf
 1 26
o
 10 3
cbacbacbac
 10 5
abcabcabca
 26 26
ahnxdnbfcriersyzdihuecojdi
 1 2
b
 13 7
gfegfegfegfeg
 1 1
a
 6 3
acbacb
 17 26
bazyxzyxzyxzyxzyx
 12 10
abcabcabcabc
 333 5
edcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedc
 1 26
z
 3 3
cab
 15 11
cgjkbadjfbdaikj
 6 3
abcabc
 17 4
dabcadcbdcadbcdbc
 30 7
cedcfedcfgcfgcbadcadgfaegfacgf
 30 26
abcabcabczyxzyxzyxzyxzyxzyxzyx
 2 2
ba

acbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbac
 acbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacb
 fajegfaicd
 NO
 abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcd
 acebc
 dab
 ba
 acbacbacbac
 zab
 da
 NO
 bac
 b
 cadgbagbcaecgfaegcdbeafbacbdfgaedgcdeabgebaecbeacgfebagedcegdafdgeacfabcabcab
 p
 NO
 abcabcabcd
 ahnxdnbfcriersyzdihuecojdk
 NO
 NO
 NO
 bacbac
 bcabcabcabcabcabc
 abcabcabcabd
 NO
 NO
 cba
 cgjkbadjfbdajba
 acbacb
 dabcadcbdcadcabca
 cedcfedcfgcfgcbadcadgfaegfadba
 abcabcabdabcabcabcabcabcabcabc
 NO

import java.io.*;
import java.util.*;


public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(in, out);
        out.close();
    }
}


class Manacher {
    private int[]  p; 
    private String s; 
    private char[] t;  

    public Manacher(String s) {
        this.s = s;
        t = preprocess(s);
        p = new int[t.length];

        int center = 0, right = 0;
        for (int i = 1; i < t.length-1; i++) {
            int mirror = 2*center - i;

            if (right > i) p[i] = Math.min(right - i, p[mirror]);

            while (t[i + (1 + p[i])] == t[i - (1 + p[i])])
                p[i]++;

            if (i + p[i] > right) {
                center = i;
                right = i + p[i];
            }
        }

    }

    public char[] preprocess(String s) {
        char[] t = new char[s.length()*2 + 3];
        t[0] = '$';
        t[s.length()*2 + 2] = '@';
        for (int i = 0; i < s.length(); i++) {
            t[2*i + 1] = '#';
            t[2*i + 2] = s.charAt(i);
        }
        t[s.length()*2 + 1] = '#';
        return t;
    }

    public int lengthOfLongestPalindromeSubstring() {
        int length = 0;  
        for (int i = 1; i < p.length-1; i++) {
            if (p[i] > length) {
                length = p[i];
            }
        }
        return length;
    }

}


class TaskC {

    public void solve(InputReader in, OutputWriter out) {
        int n = in.nextInt();
        int p = in.nextInt();
        int tab[] = new int[n];
        String line = in.next();
        for (int i = 0; i < n; i++) {
            int val = line.charAt(i) - 97;
            tab[i] = val;
        }
        boolean firstWord = true;
        boolean findNext = false;
        while(!findNext) {
            if(containAnyPalindorme(tab) || firstWord) {
                int i = tab.length - 1;
                boolean overflow = true;
                int numberOfOverflow = 0;
                while(overflow && i>=0) {
                    tab[i] = (tab[i] + 1 ) % (p);
                    if(tab[i] == 0) {
                        i--;
                        numberOfOverflow++;
                    } else {
                        overflow = false;
                    }
                }
                if(numberOfOverflow == n) break;
            } else {
                findNext = true;
            }
            firstWord = false;
        }

        if(findNext) {
            for (int i = 0; i < tab.length; i++) {
                out.printLine((char) (tab[i] + 97));
            }
        } else {
            out.printLine("NO");
        }

    }

    private boolean containAnyPalindorme(int[] tab) {
        StringBuffer stringBuffer = new StringBuffer();
        for (int i = 0; i < tab.length; i++) {
            stringBuffer.append(tab[i]);
        }
        Manacher manacher = new Manacher(stringBuffer.toString());

        return manacher.lengthOfLongestPalindromeSubstring() >= 2;
    }

}




class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }
    public long nextLong() {
        return Long.parseLong(next());
    }

}

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0) {
                writer.print(' ');
            }
            writer.print(objects[i]);
        }
    }

    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }

}