import java.math.BigInteger;
import java.util.*;

import ru.ifmo.testlib.Checker;
import ru.ifmo.testlib.InStream;
import ru.ifmo.testlib.Outcome;
import ru.ifmo.testlib.Outcome.Type;

public class Check implements Checker {

	@Override
	public Outcome test(InStream inf, InStream ouf, InStream ans) {
		int n = inf.nextInt();
		
		int length = ouf.nextInt();
		
		if (length > 2 * fact(n)) {
			return new Outcome(Type.WA, "Length " + length + " is too long (should be <= "  + (2 * fact(n)) + ")");
		}
		
		int[] seq = new int[length];
		for (int i = 0; i < length; i++) {
			seq[i] = ouf.nextInt() - 1;
			if (seq[i] < 0 || seq[i] >= n) {
				return new Outcome(Type.WA, (i + 1) + "th element of sequence violates range [1, " + n + "]");
			}
		}
		
		Set<Long> occuringPerms = new HashSet<Long>();
		int[] count = new int[n];
		int countZeros = n;
		long pow10 = BigInteger.TEN.pow(n).longValue();
		long permRepr = 0;
		for (int i = 0; i < length; i++) {
			int item = seq[i];
			if (count[item] == 0) {
				countZeros--;
			}
			count[item]++;
			permRepr = 10 * permRepr + item;
			
			if (i - n >= 0) {
				item = seq[i - n];
				if (count[item] == 1) {
					countZeros++;
				}
				count[item]--;
				permRepr -= item * pow10;
			}
			
			if (countZeros == 0) {
				occuringPerms.add(permRepr);
			}
		}
		
		if (occuringPerms.size() < fact(n)) {
			return new Outcome(Type.WA, "Not all " + fact(n) + " permutations occur in this sequence");
		}
		if (occuringPerms.size() > fact(n)) {
			return new Outcome(Type.FAIL, "WTF?");
		}
		return new Outcome(Type.OK, "OK");
	}

	private int fact(int n) {
		int result = 1;
		for (int i = 2; i <= n; i++) {
			result *= i;
		}
		return result;
	}
}
